Skip to content

Commit

Permalink
Channelhandler support libuv type executor
Browse files Browse the repository at this point in the history
  • Loading branch information
fanliang11 committed Apr 11, 2024
1 parent 483b9a0 commit 49a309d
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,14 @@ public async Task StartAsync(EndPoint endPoint)
IEventLoopGroup bossGroup = new MultithreadEventLoopGroup(1);
IEventLoopGroup workerGroup = new MultithreadEventLoopGroup();//Default eventLoopCount is Environment.ProcessorCount * 2
var bootstrap = new ServerBootstrap();

IEventLoopGroup eventExecutor = new MultithreadEventLoopGroup();
if (AppConfig.ServerOptions.Libuv)
{
var dispatcher = new DispatcherEventLoopGroup();
bossGroup = dispatcher;
workerGroup = new WorkerEventLoopGroup(dispatcher);
var dispatcherExecutor = new DispatcherEventLoopGroup();
eventExecutor = new WorkerEventLoopGroup(dispatcherExecutor);
bootstrap.Channel<TcpServerChannel>();
}
else
Expand All @@ -79,7 +81,6 @@ public async Task StartAsync(EndPoint endPoint)
workerGroup = new MultithreadEventLoopGroup();
bootstrap.Channel<TcpServerSocketChannel>();
}
var eventExecutor = new MultithreadEventLoopGroup();
bootstrap
.Option(ChannelOption.SoBacklog, AppConfig.ServerOptions.SoBacklog)
.ChildOption(ChannelOption.Allocator, PooledByteBufferAllocator.Default)
Expand Down

0 comments on commit 49a309d

Please sign in to comment.