aboutsummaryrefslogtreecommitdiff
path: root/src/core/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/socket.c')
-rw-r--r--src/core/socket.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/socket.c b/src/core/socket.c
index 3a209441..faca1b06 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -532,6 +532,7 @@ nni_sock_create(nni_sock **sp, const nni_proto *proto)
{
int rv;
nni_sock *s;
+ bool on;
if ((s = NNI_ALLOC_STRUCT(s)) == NULL) {
return (NNG_ENOMEM);
@@ -587,6 +588,16 @@ nni_sock_create(nni_sock **sp, const nni_proto *proto)
return (rv);
}
+ // These we *attempt* to call so that we are likely to have initial
+ // values loaded. They should not fail, but if they do we don't
+ // worry about it.
+ on = true;
+ (void) nni_sock_setopt(
+ s, NNG_OPT_TCP_NODELAY, &on, sizeof(on), NNI_TYPE_BOOL);
+ on = false;
+ (void) nni_sock_setopt(
+ s, NNG_OPT_TCP_KEEPALIVE, &on, sizeof(on), NNI_TYPE_BOOL);
+
if (s->s_sock_ops.sock_filter != NULL) {
nni_msgq_set_filter(
s->s_urq, s->s_sock_ops.sock_filter, s->s_data);