1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-09 11:53:13 +02:00

I/O engine: don't request write notification if we don't need it.

In testing with 1000 TLS clients this saves around 16% of unrealircd
CPU time (so not 16% CPU, but 16% of whatever % unrealircd cpu is).
This commit is contained in:
Bram Matthys
2025-10-03 15:59:50 +02:00
parent 45ef8d1cf1
commit 902802a8dc
+6 -1
View File
@@ -1195,8 +1195,13 @@ void read_packet(int fd, int revents, void *data)
* it may be overwritten in an earlier call to read_packet(),
* to handle (TLS) writes by read_packet(), see below under
* SSL_ERROR_WANT_WRITE.
* Update 2025-10-03: actually only restore it to send_queued_cb
* if we actually have anything to send, otherwise set to NULL.
*/
fd_setselect(fd, FD_SELECT_WRITE, send_queued_cb, client);
if (DBufLength(&client->local->sendQ) > 0)
fd_setselect(fd, FD_SELECT_WRITE, send_queued_cb, client);
else
fd_setselect(fd, FD_SELECT_WRITE, NULL, client);
while (1)
{