mirror of
https://github.com/osmarks/ngircd.git
synced 2024-12-12 01:40:27 +00:00
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 04de1423eb
.
This commit is contained in:
parent
9540d0c0a4
commit
843cbfc0f3
@ -1291,14 +1291,12 @@ Handle_Write( CONN_ID Idx )
|
|||||||
if (errno == EAGAIN || errno == EINTR)
|
if (errno == EAGAIN || errno == EINTR)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* Log write errors but do not close the connection yet.
|
if (!Conn_OPTION_ISSET(&My_Connections[Idx], CONN_ISCLOSING)) {
|
||||||
* Calling Conn_Close() now could result in too many recursive calls.
|
|
||||||
*/
|
|
||||||
if (!Conn_OPTION_ISSET(&My_Connections[Idx], CONN_ISCLOSING))
|
|
||||||
Log(LOG_ERR,
|
Log(LOG_ERR,
|
||||||
"Write error on connection %d (socket %d): %s!",
|
"Write error on connection %d (socket %d): %s!",
|
||||||
Idx, My_Connections[Idx].sock, strerror(errno));
|
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!",
|
LogDebug("Recursive write error on connection %d (socket %d): %s!",
|
||||||
Idx, My_Connections[Idx].sock, strerror(errno));
|
Idx, My_Connections[Idx].sock, strerror(errno));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user