Hello,
I am using libstrophe to monitor my home jabber server - basically connecting to the server, and then disconnecting right away. My application does that every few minutes.
I noticed that the XMPP connections I open are not being closed - they are left in a 'CLOSE_WAIT' state, visible in a netstat output and they accumulate over time:
(etc...)
I can only assume that I am using the library wrong. This is what I do (I removed all error checking for readability):
void do_test() {
xmpp_ctx_t *xmpp_ctx = NULL;
xmpp_conn_t *xmpp_conn = NULL;
/* initialize the xmpp library, context and connection structures */
xmpp_initialize();
xmpp_ctx = xmpp_ctx_new(NULL, NULL);
xmpp_conn = xmpp_conn_new(xmpp_ctx);
/* setup auth information */
xmpp_conn_set_jid(xmpp_conn, "mylogin");
xmpp_conn_set_pass(xmpp_conn, "mypassword");
xmpp_conn_set_flags(xmpp_conn, XMPP_CONN_FLAG_TRUST_TLS);
/* connect */
xmpp_connect_client(xmpp_conn, altserverptr, c->altport, conn_handler, xmpp_ctx);
while (conn_handler_done_flag == 0) xmpp_run_once(xmpp_ctx, 5000);
/* cleanup and shutdown */
xmpp_disconnect(xmpp_conn);
xmpp_run_once(xmpp_ctx, 100);
xmpp_conn_release(xmpp_conn);
xmpp_ctx_free(xmpp_ctx);
xmpp_shutdown();
}
Any idea what I am missing?
best regards,
Mateusz