Module: kamailio
Branch: master
Commit: d340582267174ccb0a5d816049c582fe75d2177b
URL:
https://github.com/kamailio/kamailio/commit/d340582267174ccb0a5d816049c582f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-11-03T09:24:13+01:00
evapi: enable tcp keepalive on client connections
---
Modified: src/modules/evapi/evapi_dispatch.c
---
Diff:
https://github.com/kamailio/kamailio/commit/d340582267174ccb0a5d816049c582f…
Patch:
https://github.com/kamailio/kamailio/commit/d340582267174ccb0a5d816049c582f…
---
diff --git a/src/modules/evapi/evapi_dispatch.c b/src/modules/evapi/evapi_dispatch.c
index e5b11b18cf..c70e1a2789 100644
--- a/src/modules/evapi/evapi_dispatch.c
+++ b/src/modules/evapi/evapi_dispatch.c
@@ -488,6 +488,8 @@ void evapi_accept_client(struct ev_loop *loop, struct ev_io *watcher,
int revent
struct ev_io *evapi_client;
int i;
evapi_env_t evenv;
+ int optval;
+ socklen_t optlen;
if(_evapi_clients==NULL) {
LM_ERR("no client structures\n");
@@ -538,6 +540,12 @@ void evapi_accept_client(struct ev_loop *loop, struct ev_io *watcher,
int revent
return;
}
}
+ optval = 1;
+ optlen = sizeof(optval);
+ if(setsockopt(csock, SOL_SOCKET, SO_KEEPALIVE,
+ &optval, optlen) < 0) {
+ LM_WARN("failed to enable keepalive on socket %d\n", csock);
+ }
_evapi_clients[i].connected = 1;
_evapi_clients[i].sock = csock;
_evapi_clients[i].af = caddr.sa_family;