Commit 4375415b authored by Luke Bratch's avatar Luke Bratch
Browse files

Relay server PINGs to all clients in case they rely on PINGs to stay alive.

parent c1799538
......@@ -24,4 +24,11 @@ Do connectcommands happen on reconnect?
Are "no such nick/channel" messages as shown in clients correct compared to non-(bla)bouncer clients?
Support ban list when requesting /mode #channel +b (commands 367 and 368 at least) - ensure max ban list length is supported. example:
:irc.tghost.co.uk 367 l_bratch #foo *!foo@bar.bz l_bratch 1642588731
:irc.tghost.co.uk 367 l_bratch #foo *!*bbuser@*.bratch.co.uk l_bratch 1642588681
:irc.tghost.co.uk 368 l_bratch #foo :End of Channel Ban List
Or if there are no bans then just 368:
:irc.tghost.co.uk 368 l_bratch #foo :End of Channel Ban List
Crash when requesting 30 hour replay.
......@@ -39,6 +39,14 @@ int processservermessage(SSL *server_ssl, char *str, struct client *clients, int
// sourcefd = 0 as this is a trusted response
sendtoserver(server_ssl, outgoingmsg, strlen(outgoingmsg), 0, clients, settings);
// Also relay the request to all clients in case they were expecting PINGs to keep themselves alive
if (!snprintf(outgoingmsg, MAXDATASIZE, "PING %s", tokens[1])) { // TODO - Make sure tokens[1] actually has a token
fprintf(stderr, "Error while preparing PING relay!\n");
debugprint(DEBUG_CRIT, "Error while preparing PING relay!\n");
outgoingmsg[0] = '\0';
}
sendtoallclients(clients, outgoingmsg, EXCEPT_NONE, settings);
// We processed something so return true
return 1;
}
......@@ -1091,6 +1099,13 @@ int processclientmessage(SSL *server_ssl, char *str, struct client *clients, int
return 1;
}
// Client PONG received? This is almost certainly in response to a relayed server PING from us.
// We can ignore it since we don't actively PING clients, instead relying on the server's PING frequency.
if (strncasecmp(tokens[0], "PONG", strlen(tokens[0])) == 0) {
debugprint(DEBUG_FULL, "Client PONG found and it is: %s with length %zd! Ignoring since we don't track client PONGs.\n", tokens[0], strlen(tokens[0]));
return 1;
}
// TODO - Ignoring CAP for now so as not to confuse other clients, but we should probably query the server then relay the response to the client
if (strncasecmp(tokens[0], "CAP", strlen(tokens[0])) == 0) {
debugprint(DEBUG_FULL, "Client CAP found and it is: %s with length %zd! Ignoring completely for now - TODO - do something useful!\n", tokens[0], strlen(tokens[0]));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment