- send periodic tcp keepalive packets to server in order to prevent connection from closing You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/1808
-- Commit Summary --
* janssonrpcc: add new parameter "keep_alive"
-- File Changes --
M src/modules/janssonrpcc/doc/janssonrpcc_admin.xml (19) M src/modules/janssonrpcc/janssonrpc_connect.c (56) M src/modules/janssonrpcc/janssonrpc_server.h (1) M src/modules/janssonrpcc/janssonrpc_srv.h (1) M src/modules/janssonrpcc/janssonrpcc_mod.c (16)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/1808.patch https://github.com/kamailio/kamailio/pull/1808.diff
miconda commented on this pull request.
@@ -79,6 +82,11 @@ void force_disconnect(jsonrpc_server_t* server)
server->buffer = NULL;
server->status = JSONRPC_SERVER_DISCONNECTED; + if (server->keep_alive_socket_fd) { + INFO("closing socket"); + close(server->keep_alive_socket_fd); + server->keep_alive_socket_fd = -1; + }
I think that the condition above should be:
``` if (server->keep_alive_socket_fd>=0) { ``` otherwise it will be true after you close the socket and set the value of the field to -1. So next time you will close fd -1, which is invalid.
eschmidbauer commented on this pull request.
@@ -79,6 +82,11 @@ void force_disconnect(jsonrpc_server_t* server)
server->buffer = NULL;
server->status = JSONRPC_SERVER_DISCONNECTED; + if (server->keep_alive_socket_fd) { + INFO("closing socket"); + close(server->keep_alive_socket_fd); + server->keep_alive_socket_fd = -1; + }
thanks! i've updated the PR
Can be merged.
Merged #1808 into master.