commit - 9f05f5ee61d23292d55edef09439c38936b86037
commit + 54fac576030d7aaf8bce4a982c880fe18680741e
blob - 7d1576e1efcb4ec9b1cbcaf4f7fdd92093b31405
blob + ca7030f4ebae1e487910310da2278e96f8287252
--- src/ngircd/conn.c
+++ src/ngircd/conn.c
continue;
}
+ if (array_bytes(&My_Connections[i].rbuf) >= COMMAND_LEN) {
+ /* There is still more data in the read buffer
+ * than a single valid command can get long:
+ * so either there is a complete command, or
+ * invalid data. Therefore don't try to read in
+ * even more data from the network but wait for
+ * this command(s) to be handled first! */
+ io_event_del(My_Connections[i].sock,
+ IO_WANTREAD);
+ continue;
+ }
+
io_event_add(My_Connections[i].sock, IO_WANTREAD);
}
assert(Idx > NONE);
assert(My_Connections[Idx].sock > NONE);
+ /* Check if the read buffer is "full". Basically this shouldn't happen
+ * here, because as long as there possibly are commands in the read
+ * buffer (buffer usage > COMMAND_LEN), the socket shouldn't be
+ * scheduled for reading in Conn_Handler() at all ... */
#ifdef ZLIB
if ((array_bytes(&My_Connections[Idx].rbuf) >= READBUFFER_LEN) ||
(array_bytes(&My_Connections[Idx].zip.rbuf) >= READBUFFER_LEN))
if (array_bytes(&My_Connections[Idx].rbuf) >= READBUFFER_LEN)
#endif
{
- /* Read buffer is full */
Log(LOG_ERR,
"Receive buffer space exhausted (connection %d): %d/%d bytes",
Idx, array_bytes(&My_Connections[Idx].rbuf), READBUFFER_LEN);