<p><b>@miconda</b> commented on this pull request.</p>

<hr>

<p>In <a href="https://github.com/kamailio/kamailio/pull/1808#discussion_r247194816">src/modules/janssonrpcc/janssonrpc_connect.c</a>:</p>
<pre style='color:#555'>> @@ -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;
+       }
 
</pre>
<p>I think that the condition above should be:</p>
<pre><code>if (server->keep_alive_socket_fd>=0) {
</code></pre>
<p>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.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/pull/1808#pullrequestreview-191765113">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AF36ZacjUsTFymU6t4VPxOm3mVaqGhNtks5vCMmmgaJpZM4Z7wej">mute the thread</a>.<img src="https://github.com/notifications/beacon/AF36ZfT29IHTIQ2qEFnTfjiVD1gOdbdyks5vCMmmgaJpZM4Z7wej.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"PERSON","message":"@miconda commented on #1808"}],"action":{"name":"View Pull Request","url":"https://github.com/kamailio/kamailio/pull/1808#pullrequestreview-191765113"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/pull/1808#pullrequestreview-191765113",
"url": "https://github.com/kamailio/kamailio/pull/1808#pullrequestreview-191765113",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>