Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ lazy val node = crossProject(JSPlatform)
scalacOptions += "-nowarn",
Compile / doc / sources := Nil,
scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule)),
Compile / npmDevDependencies += "@types/node" -> "16.7.13",
Compile / npmDevDependencies += "@types/node" -> "16.11.7",
useYarn := true,
yarnExtraArgs += "--frozen-lockfile",
stOutputPackage := "fs2.internal.jsdeps",
Expand Down
15 changes: 12 additions & 3 deletions io/js/src/main/scala/fs2/io/net/DatagramSocketOption.scala
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,18 @@ object DatagramSocketOption {

private object MulticastLoopback extends Key[Boolean] {
override private[net] def set[F[_]: Sync](sock: dgramMod.Socket, value: Boolean): F[Unit] =
Sync[F].delay(sock.setMulticastLoopback(value))
Sync[F].delay {
sock.setMulticastLoopback(value)
()
}
}

private object MulticastTtl extends Key[Int] {
override private[net] def set[F[_]: Sync](sock: dgramMod.Socket, value: Int): F[Unit] =
Sync[F].delay(sock.setMulticastTTL(value.toDouble))
Sync[F].delay {
sock.setMulticastTTL(value.toDouble)
()
}
}

private object ReceiveBufferSize extends Key[Int] {
Expand All @@ -81,7 +87,10 @@ object DatagramSocketOption {

private object Ttl extends Key[Int] {
override private[net] def set[F[_]: Sync](sock: dgramMod.Socket, value: Int): F[Unit] =
Sync[F].delay(sock.setTTL(value.toDouble))
Sync[F].delay {
sock.setTTL(value.toDouble)
()
}
}

def broadcast(value: Boolean): DatagramSocketOption = apply(Broadcast, value)
Expand Down
4 changes: 2 additions & 2 deletions io/js/src/main/scala/fs2/io/net/SocketPlatform.scala
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ private[net] trait SocketCompanionPlatform {

override def localAddress: F[SocketAddress[IpAddress]] =
for {
ip <- F.delay(IpAddress.fromString(sock.localAddress).get)
port <- F.delay(Port.fromInt(sock.localPort.toInt).get)
ip <- F.delay(sock.localAddress.toOption.flatMap(IpAddress.fromString).get)
port <- F.delay(sock.localPort.toOption.map(_.toInt).flatMap(Port.fromInt).get)
} yield SocketAddress(ip, port)

override def write(bytes: Chunk[Byte]): F[Unit] =
Expand Down
8 changes: 4 additions & 4 deletions io/js/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.4.12.tgz#961e3091f263e6345d2d84afab4e047a60b4b11b"
integrity sha512-zxrTNFl9Z8boMJXs6ieqZP0wAhvkdzmHSxTlJabM16cf5G9xBc1uPRH5Bbv2omEDDiM8MzTfqTJXBf0Ba4xFWA==

"@types/node@16.7.13":
version "16.7.13"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.7.13.tgz#86fae356b03b5a12f2506c6cf6cd9287b205973f"
integrity sha512-pLUPDn+YG3FYEt/pHI74HmnJOWzeR+tOIQzUx93pi9M7D8OE7PSLr97HboXwk5F+JS+TLtWuzCOW97AHjmOXXA==
"@types/node@16.11.7":
version "16.11.7"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.7.tgz#36820945061326978c42a01e56b61cd223dfdc42"
integrity sha512-QB5D2sqfSjCmTuWcBWyJ+/44bcjO7VbjSbOE0ucoVbAsSNQc4Lt6QkgkVXkTDwkL4z/beecZNDvVX15D4P8Jbw==

"@webassemblyjs/ast@1.8.5":
version "1.8.5"
Expand Down
8 changes: 4 additions & 4 deletions node/js/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.4.12.tgz#961e3091f263e6345d2d84afab4e047a60b4b11b"
integrity sha512-zxrTNFl9Z8boMJXs6ieqZP0wAhvkdzmHSxTlJabM16cf5G9xBc1uPRH5Bbv2omEDDiM8MzTfqTJXBf0Ba4xFWA==

"@types/node@16.7.13":
version "16.7.13"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.7.13.tgz#86fae356b03b5a12f2506c6cf6cd9287b205973f"
integrity sha512-pLUPDn+YG3FYEt/pHI74HmnJOWzeR+tOIQzUx93pi9M7D8OE7PSLr97HboXwk5F+JS+TLtWuzCOW97AHjmOXXA==
"@types/node@16.11.7":
version "16.11.7"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.7.tgz#36820945061326978c42a01e56b61cd223dfdc42"
integrity sha512-QB5D2sqfSjCmTuWcBWyJ+/44bcjO7VbjSbOE0ucoVbAsSNQc4Lt6QkgkVXkTDwkL4z/beecZNDvVX15D4P8Jbw==

"@webassemblyjs/ast@1.8.5":
version "1.8.5"
Expand Down