diff --git a/zio-http/src/main/scala/zio/http/Channel.scala b/zio-http/src/main/scala/zio/http/Channel.scala index 4ec514f56a..e729629feb 100644 --- a/zio-http/src/main/scala/zio/http/Channel.scala +++ b/zio-http/src/main/scala/zio/http/Channel.scala @@ -56,15 +56,15 @@ trait Channel[-In, +Out] { self => */ final def contramap[In2](f: In2 => In): Channel[In2, Out] = new Channel[In2, Out] { - def awaitShutdown: UIO[Unit] = + def awaitShutdown: UIO[Unit] = self.awaitShutdown - def receive: Task[Out] = + def receive: Task[Out] = self.receive - def send(in: In2): Task[Unit] = + def send(in: In2): Task[Unit] = self.send(f(in)) def sendAll(in: Iterable[In2]): Task[Unit] = self.sendAll(in.map(f)) - def shutdown: UIO[Unit] = + def shutdown: UIO[Unit] = self.shutdown } @@ -74,15 +74,15 @@ trait Channel[-In, +Out] { self => */ final def map[Out2](f: Out => Out2): Channel[In, Out2] = new Channel[In, Out2] { - def awaitShutdown: UIO[Unit] = + def awaitShutdown: UIO[Unit] = self.awaitShutdown - def receive: Task[Out2] = + def receive: Task[Out2] = self.receive.map(f) - def send(in: In): Task[Unit] = + def send(in: In): Task[Unit] = self.send(in) def sendAll(in: Iterable[In]): Task[Unit] = self.sendAll(in) - def shutdown: UIO[Unit] = + def shutdown: UIO[Unit] = self.shutdown } diff --git a/zio-http/src/main/scala/zio/http/WebSocketChannel.scala b/zio-http/src/main/scala/zio/http/WebSocketChannel.scala index 50962dc110..dc315fdb03 100644 --- a/zio-http/src/main/scala/zio/http/WebSocketChannel.scala +++ b/zio-http/src/main/scala/zio/http/WebSocketChannel.scala @@ -31,11 +31,11 @@ private[http] object WebSocketChannel { queue: Queue[WebSocketChannelEvent], ): WebSocketChannel = new WebSocketChannel { - def awaitShutdown: UIO[Unit] = + def awaitShutdown: UIO[Unit] = nettyChannel.awaitClose - def receive: Task[WebSocketChannelEvent] = + def receive: Task[WebSocketChannelEvent] = queue.take - def send(in: WebSocketChannelEvent): Task[Unit] = + def send(in: WebSocketChannelEvent): Task[Unit] = in match { case Read(message) => nettyChannel.writeAndFlush(frameToNetty(message)) case _ => ZIO.unit @@ -45,7 +45,7 @@ private[http] object WebSocketChannel { case Read(message) => nettyChannel.write(frameToNetty(message)) case _ => ZIO.unit } *> nettyChannel.flush - def shutdown: UIO[Unit] = + def shutdown: UIO[Unit] = nettyChannel.close(false).orDie }