Module: kamailio
Branch: 5.0
Commit: 5f26a4e8c55cdf5a5a7eaf6864c4f5213d321293
URL:
https://github.com/kamailio/kamailio/commit/5f26a4e8c55cdf5a5a7eaf6864c4f52…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2017-11-29T13:53:10+01:00
evapi: enable tcp keepalive on client connections
(cherry picked from commit d340582267174ccb0a5d816049c582fe75d2177b)
---
Modified: src/modules/evapi/evapi_dispatch.c
---
Diff:
https://github.com/kamailio/kamailio/commit/5f26a4e8c55cdf5a5a7eaf6864c4f52…
Patch:
https://github.com/kamailio/kamailio/commit/5f26a4e8c55cdf5a5a7eaf6864c4f52…
---
diff --git a/src/modules/evapi/evapi_dispatch.c b/src/modules/evapi/evapi_dispatch.c
index 3aa5288c7f..9fcde59f39 100644
--- a/src/modules/evapi/evapi_dispatch.c
+++ b/src/modules/evapi/evapi_dispatch.c
@@ -450,6 +450,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;
evapi_client = (struct ev_io*) malloc (sizeof(struct ev_io));
if(evapi_client==NULL) {
@@ -496,6 +498,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;