diff --git a/src/event.c b/src/event.c index 32a4898..1d6fd4c 100644 --- a/src/event.c +++ b/src/event.c @@ -218,7 +218,8 @@ void xmpp_run_once(xmpp_ctx_t *ctx, const unsigned long timeout) tls_read_bytes += tls_pending(conn->tls); } - if (conn->sock > max) max = conn->sock; + if (conn->state != XMPP_STATE_DISCONNECTED && conn->sock > max) + max = conn->sock; connitem = connitem->next; }