Immediately shut down connection on receiving ERROR

Don't wait for the peer to close the connection. This allows us to
forward the ERROR mesage in the network, instead of the very generic
"client closed connection" message.
This commit is contained in:
Alexander Barton 2016-12-08 01:01:40 +01:00
parent e9e3df27b7
commit 77861f6fe2
1 changed files with 13 additions and 3 deletions

View File

@ -85,6 +85,8 @@ IRC_CheckListTooBig(CLIENT *From, const int Count, const int Limit,
GLOBAL bool GLOBAL bool
IRC_ERROR(CLIENT *Client, REQUEST *Req) IRC_ERROR(CLIENT *Client, REQUEST *Req)
{ {
char *msg;
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
@ -99,12 +101,20 @@ IRC_ERROR(CLIENT *Client, REQUEST *Req)
return CONNECTED; return CONNECTED;
} }
if (Req->argc < 1) if (Req->argc < 1) {
msg = "Got ERROR command";
Log(LOG_NOTICE, "Got ERROR from \"%s\"!", Log(LOG_NOTICE, "Got ERROR from \"%s\"!",
Client_Mask(Client)); Client_Mask(Client));
else } else {
msg = Req->argv[0];
Log(LOG_NOTICE, "Got ERROR from \"%s\": \"%s\"!", Log(LOG_NOTICE, "Got ERROR from \"%s\": \"%s\"!",
Client_Mask(Client), Req->argv[0]); Client_Mask(Client), msg);
}
if (Client_Conn(Client) != NONE) {
Client_Destroy(Client, NULL, msg, false);
return DISCONNECTED;
}
return CONNECTED; return CONNECTED;
} /* IRC_ERROR */ } /* IRC_ERROR */