event: set socket to wfds when sending queue is not empty

Don't sleep in select(2) when system is ready to send data.
This commit is contained in:
Dmitry Podgorny
2017-07-05 20:36:34 +03:00
parent 49289a9c05
commit d8a86a54d5

View File

@@ -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 */