Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
adamgfraser committed Mar 23, 2022
1 parent 9391329 commit 72ffc6b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions zio-http/src/main/scala/zhttp/service/ChannelFuture.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class ChannelFuture[A] private (jFuture: Future[A]) {
.onInterrupt(ZIO.succeed(jFuture.removeListener(handler)))
}

def scoped: ZIO[Scope, Throwable, Option[A]] = {
def toZIO: ZIO[Scope, Throwable, Option[A]] = {
execute.withFinalizer(cancel(true))
}

Expand All @@ -42,5 +42,5 @@ object ChannelFuture {

def unit[A](jFuture: => Future[A]): Task[Unit] = make(jFuture).flatMap(_.execute.unit)

def scoped[A](jFuture: => Future[A]): ZIO[Scope, Throwable, Unit] = make(jFuture).flatMap(_.scoped.unit)
def asZIO[A](jFuture: => Future[A]): ZIO[Scope, Throwable, Unit] = make(jFuture).flatMap(_.toZIO.unit)
}
2 changes: 1 addition & 1 deletion zio-http/src/main/scala/zhttp/service/Server.scala
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ object Server {
init = ServerChannelInitializer(zExec, settings, reqHandler)
serverBootstrap = new ServerBootstrap().channelFactory(channelFactory).group(eventLoopGroup)
chf <- ZIO.attempt(serverBootstrap.childHandler(init).bind(settings.address))
_ <- ChannelFuture.scoped(chf)
_ <- ChannelFuture.asZIO(chf)
port <- ZIO.attempt(chf.channel().localAddress().asInstanceOf[InetSocketAddress].getPort)
} yield {
ResourceLeakDetector.setLevel(settings.leakDetectionLevel.jResourceLeakDetectionLevel)
Expand Down

0 comments on commit 72ffc6b

Please sign in to comment.