diff options
| author | Alexander Barton <alex@barton.de> | 2023-11-24 18:16:36 +0100 |
|---|---|---|
| committer | Alexander Barton <alex@barton.de> | 2024-01-06 16:21:01 +0100 |
| commit | 843cbfc0f32042c26836753340ef6b681b66d8c2 (patch) | |
| tree | 9e7c0442cccbd4637e70e0c070605ce35d2fdbca /src | |
| parent | 9540d0c0a4b00618e6e45744b11198760a2df2f1 (diff) | |
| download | ngircd-843cbfc0f32042c26836753340ef6b681b66d8c2.tar.gz ngircd-843cbfc0f32042c26836753340ef6b681b66d8c2.zip | |
Always initiate closing a connection on errors.
Always try to close a connection with errors immediately, but try hard to avoid too much recursion. Without this patch, an outgoing server connection could get stuck in an "endless" state trying to write out data over and over again. This tries to fix 04de1423eb26.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ngircd/conn.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c index e8ef68f3..7097f1ac 100644 --- a/src/ngircd/conn.c +++ b/src/ngircd/conn.c @@ -1291,14 +1291,12 @@ Handle_Write( CONN_ID Idx ) if (errno == EAGAIN || errno == EINTR) return true; - /* Log write errors but do not close the connection yet. - * Calling Conn_Close() now could result in too many recursive calls. - */ - if (!Conn_OPTION_ISSET(&My_Connections[Idx], CONN_ISCLOSING)) + if (!Conn_OPTION_ISSET(&My_Connections[Idx], CONN_ISCLOSING)) { Log(LOG_ERR, "Write error on connection %d (socket %d): %s!", Idx, My_Connections[Idx].sock, strerror(errno)); - else + Conn_Close(Idx, "Write error", NULL, false); + } else LogDebug("Recursive write error on connection %d (socket %d): %s!", Idx, My_Connections[Idx].sock, strerror(errno)); |