@Override @SuppressWarnings("CloneDoesntCallSuperClone") public UkcpServerBootstrap clone() { return new UkcpServerBootstrap(this); }
/** * Returns the configured {@link io.netty.channel.ChannelHandler} be used for the child channels or {@code null} * if non is configured yet. */ public ChannelHandler childHandler() { return bootstrap.childHandler(); }
public static UkcpServerBootstrap nodelay(UkcpServerBootstrap b, boolean nodelay, int interval, int fastResend, boolean nocwnd) { b.childOption(UkcpChannelOption.UKCP_NODELAY, nodelay) .childOption(UkcpChannelOption.UKCP_INTERVAL, interval) .childOption(UkcpChannelOption.UKCP_FAST_RESEND, fastResend) .childOption(UkcpChannelOption.UKCP_NOCWND, nocwnd); return b; }
public static void main(String[] args) throws Exception { // Configure the server. EventLoopGroup group = new NioEventLoopGroup(); try { UkcpServerBootstrap b = new UkcpServerBootstrap(); b.group(group) .channel(UkcpServerChannel.class) .childHandler(new ChannelInitializer<UkcpChannel>() { @Override public void initChannel(UkcpChannel ch) throws Exception { ChannelPipeline p = ch.pipeline(); p.addLast(new KcpRttServerHandler()); } }); ChannelOptionHelper.nodelay(b, true, 20, 2, true) .childOption(UkcpChannelOption.UKCP_MTU, 512); // Start the server. ChannelFuture f = b.bind(PORT).sync(); // Wait until the server socket is closed. f.channel().closeFuture().sync(); } finally { // Shut down all event loops to terminate all threads. group.shutdownGracefully(); } }
@Override void init(Channel channel) throws Exception { final Map<ChannelOption<?>, Object> options = options0(); synchronized (options) { setChannelOptions(channel, options, logger); final Map<AttributeKey<?>, Object> attrs = attrs0(); synchronized (attrs) { for (Map.Entry<AttributeKey<?>, Object> e : attrs.entrySet()) { final Map.Entry<AttributeKey<?>, Object>[] currentChildAttrs; synchronized (childOptions) { currentChildOptions = childOptions.entrySet().toArray(newOptionArray(childOptions.size())); currentChildAttrs = childAttrs.entrySet().toArray(newAttrArray(childAttrs.size()));
final Map<ChannelOption<?>, Object> childOptions() { return copiedMap(childOptions); }
/** * Returns a copy of the configured options which will be used for the child channels. */ public Map<ChannelOption<?>, Object> childOptions() { return bootstrap.childOptions(); }
/** * Returns a copy of the configured attributes which will be used for the child channels. */ public Map<AttributeKey<?>, Object> childAttrs() { return bootstrap.childAttrs(); }
public static void main(String[] args) throws Exception { // Configure the server. EventLoopGroup group = new NioEventLoopGroup(); try { UkcpServerBootstrap b = new UkcpServerBootstrap(); b.group(group) .channel(UkcpServerChannel.class) .childHandler(new ChannelInitializer<UkcpChannel>() { @Override public void initChannel(UkcpChannel ch) throws Exception { ChannelPipeline p = ch.pipeline(); p.addLast(new EchoServerHandler()); } }); ChannelOptionHelper.nodelay(b, true, 20, 2, true) .childOption(UkcpChannelOption.UKCP_MTU, 512); // Start the server. ChannelFuture f = b.bind(PORT).sync(); // Wait until the server socket is closed. f.channel().closeFuture().sync(); } finally { // Shut down all event loops to terminate all threads. group.shutdownGracefully(); } }
final Map<AttributeKey<?>, Object> childAttrs() { return copiedMap(childAttrs); }