facebook / wangle

Wangle is a framework providing a set of common client/server abstractions for building services in a consistent, modular, and composable way.
Apache License 2.0
3.05k stars 539 forks source link

ClientBootstrap and ServerBootstrap should accept socket options #85

Open enis opened 7 years ago

enis commented 7 years ago

One can configure socket level options (TCP_NODELAY, etc) in Netty's Bootstrap like this:

    this.channel = new Bootstrap().group(rpcClient.group).channel(rpcClient.channelClass)
        .option(ChannelOption.TCP_NODELAY, rpcClient.isTcpNoDelay())
        .option(ChannelOption.SO_KEEPALIVE, rpcClient.tcpKeepAlive)
        .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, rpcClient.connectTO)

At least in ServerBootstrap there is a configurable ServerSockerFactory which can be used to configure the socket. In ClientBootstrap, I could not find an easy way to do that.

We need this for the HBase-native-client, happening here: https://issues.apache.org/jira/browse/HBASE-14850

ChingweiYu commented 7 years ago

Dear all,

Hi. I am a new of here but I want to have some contribution. How can I catch up? I have learned C++ primer. What I next step?

Thanks.

2017-02-14 7:54 GMT+08:00 Enis Soztutar notifications@github.com:

One can configure socket level options (TCP_NODELAY, etc) in Netty's Bootstrap like this:

this.channel = new Bootstrap().group(rpcClient.group).channel(rpcClient.channelClass)
    .option(ChannelOption.TCP_NODELAY, rpcClient.isTcpNoDelay())
    .option(ChannelOption.SO_KEEPALIVE, rpcClient.tcpKeepAlive)
    .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, rpcClient.connectTO)

At least in ServerBootstrap there is a configurable ServerSockerFactory which can be used to configure the socket. In ClientBootstrap, I could not find an easy way to do that.

We need this for the HBase-native-client, happening here: https://issues.apache.org/jira/browse/HBASE-14850

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/facebook/wangle/issues/85, or mute the thread https://github.com/notifications/unsubscribe-auth/AH0bJIp6u-kIfQXLqPAqIJC9tCAqyM0Pks5rcO0igaJpZM4L_4bU .

anirudhvr commented 7 years ago

@enis Yeah looks like there's no easy way yet. Probably cleanest would be to abstract out the common SocketConfig methods and create a separate ClientSocketConfig and ServerSocketConfig, and to modify ClientBootstrap to use a socket factory. cc @djwatson

djwatson commented 7 years ago

Yea pretty much. Now accepting diffs :)