Skip to content

Commit

Permalink
Merge pull request #468 from http4s/update/series/0.5/http4s-core-0.2…
Browse files Browse the repository at this point in the history
…3.19

Update http4s-circe, http4s-client, ... to 0.23.19 in series/0.5
  • Loading branch information
hamnis authored May 13, 2023
2 parents ffa3273 + 0634c2c commit fae22c5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
6 changes: 3 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ inThisBuild(
)
)

val http4sVersion = "0.23.18"
val http4sVersion = "0.23.19"

val jetty = "11.0.15"

Expand All @@ -45,13 +45,13 @@ lazy val core = project
.settings(
name := "http4s-netty-core",
libraryDependencies ++= List(
"co.fs2" %% "fs2-reactive-streams" % "3.6.1",
"co.fs2" %% "fs2-reactive-streams" % "3.7.0",
("com.typesafe.netty" % "netty-reactive-streams-http" % "2.0.8")
.exclude("io.netty", "netty-codec-http")
.exclude("io.netty", "netty-handler"),
"io.netty" % "netty-codec-http" % netty,
"org.http4s" %% "http4s-core" % http4sVersion,
"org.typelevel" %% "cats-effect" % "3.4.11"
"org.typelevel" %% "cats-effect" % "3.5.0"
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,12 @@ private[client] object Http4sChannelPoolMap {
sslConfig: SSLContextOption)

def fromFuture[F[_]: Async, A](future: => Future[A]): F[A] =
Async[F].async_ { callback =>
Async[F].async { callback =>
val fut = future
void(
future
fut
.addListener((f: Future[A]) =>
if (f.isSuccess) callback(Right(f.getNow)) else callback(Left(f.cause()))))
Async[F].delay(Some(Async[F].delay(fut.cancel(false)).void))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package org.http4s.netty.client
import cats.effect.IO
import cats.effect.Resource
import cats.effect.Sync
import cats.effect.kernel.Async
import cats.syntax.all._
import com.comcast.ip4s._
import com.github.monkeywie.proxyee.server.HttpProxyServer
Expand Down Expand Up @@ -71,8 +72,8 @@ class HttpProxyTest extends IOSuite {
}

object HttpProxyTest {
def randomSocketAddress[F[_]: Sync]: F[SocketAddress[IpAddress]] = {
def getLoopBack = Dns[F].loopback
def randomSocketAddress[F[_]: Async]: F[SocketAddress[IpAddress]] = {
def getLoopBack = Dns.forAsync[F].loopback
def randomPort = Sync[F].blocking {
val s = new ServerSocket(0)
s.close()
Expand Down
6 changes: 4 additions & 2 deletions core/src/main/scala/org/http4s/netty/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ package object netty {
implicit class NettyChannelFutureSyntax[F[_]](private val fcf: F[ChannelFuture]) extends AnyVal {
def liftToFWithChannel(implicit F: Async[F]): F[Channel] =
fcf.flatMap(cf =>
F.async_ { (callback: Either[Throwable, Channel] => Unit) =>
F.async { (callback: Either[Throwable, Channel] => Unit) =>
void(cf.addListener { (f: ChannelFuture) =>
if (f.isSuccess) callback(Right(f.channel()))
else callback(Left(f.cause()))
})
F.delay(Some(F.delay(cf.cancel(false)).void))
})
}

Expand All @@ -38,11 +39,12 @@ package object netty {
) extends AnyVal {
def liftToF(implicit F: Async[F]): F[Unit] =
ff.flatMap(f =>
F.async_ { (callback: Either[Throwable, Unit] => Unit) =>
F.async { (callback: Either[Throwable, Unit] => Unit) =>
void(f.addListener { (f: io.netty.util.concurrent.Future[_]) =>
if (f.isSuccess) callback(Right(()))
else callback(Left(f.cause()))
})
F.delay(Some(F.delay(f.cancel(false)).void))
})
}

Expand Down

0 comments on commit fae22c5

Please sign in to comment.