From d8a86a54d51b2393b6ef381b017d5261995bcaa6 Mon Sep 17 00:00:00 2001 From: Dmitry Podgorny Date: Wed, 5 Jul 2017 20:36:34 +0300 Subject: [PATCH] event: set socket to wfds when sending queue is not empty Don't sleep in select(2) when system is ready to send data. --- src/event.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/event.c b/src/event.c index ede7932..068e432 100644 --- a/src/event.c +++ b/src/event.c @@ -187,6 +187,8 @@ void xmpp_run_once(xmpp_ctx_t *ctx, const unsigned long timeout) break; case XMPP_STATE_CONNECTED: FD_SET(conn->sock, &rfds); + if (conn->send_queue_len > 0) + FD_SET(conn->sock, &wfds); break; case XMPP_STATE_DISCONNECTED: /* do nothing */