diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-04-26 13:53:40 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-04-26 13:53:40 -0700 |
| commit | 3de2b56557c80b310341c423492bd8ba895c1abe (patch) | |
| tree | 897815f4d9aa30d8c40cbed4c5fec4088d555fda /src/platform/windows | |
| parent | 492bfcc90d4b80842b024201cc1e4526404128b4 (diff) | |
| download | nng-3de2b56557c80b310341c423492bd8ba895c1abe.tar.gz nng-3de2b56557c80b310341c423492bd8ba895c1abe.tar.bz2 nng-3de2b56557c80b310341c423492bd8ba895c1abe.zip | |
fixes #105 Want NNG_OPT_TCP_NODELAY option
fixes #106 TCP keepalive tuning
Diffstat (limited to 'src/platform/windows')
| -rw-r--r-- | src/platform/windows/win_tcp.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/platform/windows/win_tcp.c b/src/platform/windows/win_tcp.c index 17f7845d..4d7d6027 100644 --- a/src/platform/windows/win_tcp.c +++ b/src/platform/windows/win_tcp.c @@ -243,6 +243,30 @@ nni_plat_tcp_pipe_sockname(nni_plat_tcp_pipe *pipe, nni_sockaddr *sa) return (0); } +int +nni_plat_tcp_pipe_set_nodelay(nni_plat_tcp_pipe *pipe, bool val) +{ + BOOL b; + b = val ? TRUE : FALSE; + if (setsockopt(pipe->s, IPPROTO_TCP, TCP_NODELAY, (void *) &b, + sizeof(b)) != 0) { + return (nni_win_error(WSAGetLastError())); + } + return (0); +} + +int +nni_plat_tcp_pipe_set_keepalive(nni_plat_tcp_pipe *pipe, bool val) +{ + BOOL b; + b = val ? TRUE : FALSE; + if (setsockopt(pipe->s, SOL_SOCKET, SO_KEEPALIVE, (void *) &b, + sizeof(b)) != 0) { + return (nni_win_error(WSAGetLastError())); + } + return (0); +} + void nni_plat_tcp_pipe_fini(nni_plat_tcp_pipe *pipe) { |
