@@ -53,6 +53,7 @@ public class RespServer implements Resp {
5353
5454 private static final int BUFFER_SIZE = 1024 * 1024 ;
5555 private static final int MAX_FRAME_SIZE = BUFFER_SIZE * 100 ;
56+ private static final int DEFAULT_BACKLOG = 1024 ;
5657
5758 private static final String DEFAULT_HOST = "localhost" ;
5859 private static final int DEFAULT_PORT = 12345 ;
@@ -79,10 +80,13 @@ public void start() {
7980 bootstrap .group (bossGroup , workerGroup )
8081 .channel (NioServerSocketChannel .class )
8182 .childHandler (new RespInitializerHandler (this ))
83+ .option (ChannelOption .SO_BACKLOG , DEFAULT_BACKLOG )
84+ .option (ChannelOption .SO_REUSEADDR , true )
8285 .option (ChannelOption .ALLOCATOR , PooledByteBufAllocator .DEFAULT )
8386 .childOption (ChannelOption .SO_RCVBUF , BUFFER_SIZE )
8487 .childOption (ChannelOption .SO_SNDBUF , BUFFER_SIZE )
8588 .childOption (ChannelOption .SO_KEEPALIVE , true )
89+ .childOption (ChannelOption .TCP_NODELAY , true )
8690 .childOption (ChannelOption .ALLOCATOR , PooledByteBufAllocator .DEFAULT );
8791
8892 future = bootstrap .bind (serverContext .getHost (), serverContext .getPort ());
0 commit comments