From aea879fa9c883aa0ff5b2c72b0fe126bb70686ce Mon Sep 17 00:00:00 2001 From: Thibault Duplessis Date: Wed, 25 Sep 2024 09:58:25 +0200 Subject: [PATCH] code golf --- src/main/scala/netty/ActorChannelConnector.scala | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/scala/netty/ActorChannelConnector.scala b/src/main/scala/netty/ActorChannelConnector.scala index d7a8cf6d..c0a6d47e 100644 --- a/src/main/scala/netty/ActorChannelConnector.scala +++ b/src/main/scala/netty/ActorChannelConnector.scala @@ -34,12 +34,10 @@ final private class ActorChannelConnector( def apply(endpoint: Endpoint, channel: Channel): Unit = val clientPromise = Promise[Client]() channel.attr(key.client).set(clientPromise.future) - val channelEmit: ClientEmit = - emitToChannel(channel, withFlush = endpoint.alwaysFlush) - val monitoredEmit: ClientEmit = (msg: ipc.ClientIn) => + val channelEmit: ClientEmit = (msg: ipc.ClientIn) => endpoint.emitCounter.increment() - channelEmit(msg) - clients ! Clients.Control.Start(endpoint.behavior(monitoredEmit), clientPromise) + emitToChannel(channel, withFlush = endpoint.alwaysFlush) + clients ! Clients.Control.Start(endpoint.behavior(channelEmit), clientPromise) channel.closeFuture.addListener: new GenericFutureListener[NettyFuture[Void]]: def operationComplete(f: NettyFuture[Void]): Unit =