On Wed, Feb 27, 2002 at 12:24:48AM +0100, Carlo Wood wrote:
> [2002-2-27 0:19:36] DEBUG [DEBUG]: Client Parsing: PRIVMSG #test
>:-----------------------------------------
> [2002-2-27 0:19:36] DEBUG [DEBUG]: poll: delay: 1014765621 (1014765576) 45000
> [2002-2-27 0:20:21] DEBUG [DEBUG]: poll: delay: 1014765681 (1014765621) 60000
> [2002-2-27 0:21:21] DEBUG [DEBUG]: poll: delay: 1014765682 (1014765681) 1000
> [2002-2-27 0:21:22] DEBUG [DEBUG]: Client Run2 Ping 10
> [2002-2-27 0:21:22] DEBUG [DEBUG]: check_pings(Run2)=status:[] limit: 10 current: 106
> [2002-2-27 0:21:22] DEBUG [DEBUG]: Sending [0x08283948] to Run2
> [2002-2-27 0:21:22] DEBUG [DEBUG]: Adding buffer 0x08283948 [ERROR :Closing Link:
>Run2 by 2.testnet.org (Ping timeout)] to normal queue
>
> It never sent a PING.
The following patch fixes this problem:
[2002-2-27 0:28:42] DEBUG [DEBUG]: Client Parsing: PRIVMSG #test
:=======================================================
[2002-2-27 0:28:42] DEBUG [DEBUG]: poll: delay: 1014766170 (1014766122) 48000
[2002-2-27 0:29:30] DEBUG [DEBUG]: poll: delay: 1014766230 (1014766170) 60000
[2002-2-27 0:30:30] DEBUG [DEBUG]: poll: delay: 1014766231 (1014766230) 1000
[2002-2-27 0:30:31] DEBUG [DEBUG]: Client Run2 Ping 10
[2002-2-27 0:30:31] DEBUG [DEBUG]: check_pings(Run2)=status:[] limit: 10 current: 109
[2002-2-27 0:30:31] DEBUG [DEBUG]: Sending [0x08283b60] to Run2
[2002-2-27 0:30:31] DEBUG [DEBUG]: Adding buffer 0x08283b60 [PING :2.afternet.org] to
normal queue
[2002-2-27 0:30:31] DEBUG [DEBUG]: [1014766231] check_pings() again in 10s
[2002-2-27 0:30:31] DEBUG [DEBUG]: poll: delay: 1014766241 (1014766231) 10000
[2002-2-27 0:30:31] DEBUG [DEBUG]: Sending queued data to Run2
[2002-2-27 0:30:31] DEBUG [DEBUG]: poll: delay: 1014766241 (1014766231) 10000
[2002-2-27 0:30:31] DEBUG [DEBUG]: Reading data from Run2
[2002-2-27 0:30:31] DEBUG [DEBUG]: Client Parsing: PONG 2.afternet.org
[2002-2-27 0:30:31] DEBUG [DEBUG]: poll: delay: 1014766241 (1014766231) 10000
[2002-2-27 0:30:41] DEBUG [DEBUG]: Client Run2 Ping 10
[2002-2-27 0:30:41] DEBUG [DEBUG]: check_pings(Run2)=status:[] limit: 10 current: 10
[2002-2-27 0:30:41] DEBUG [DEBUG]: Sending [0x08283b60] to Run2
[2002-2-27 0:30:41] DEBUG [DEBUG]: Adding buffer 0x08283b60 [PING :2.afternet.org] to
normal queue
[2002-2-27 0:30:41] DEBUG [DEBUG]: [1014766241] check_pings() again in 10s
[2002-2-27 0:30:41] DEBUG [DEBUG]: poll: delay: 1014766251 (1014766241) 10000
[2002-2-27 0:30:41] DEBUG [DEBUG]: Sending queued data to Run2
[2002-2-27 0:30:41] DEBUG [DEBUG]: poll: delay: 1014766251 (1014766241) 10000
[2002-2-27 0:30:41] DEBUG [DEBUG]: Reading data from Run2
[2002-2-27 0:30:41] DEBUG [DEBUG]: Client Parsing: PONG 2.afternet.org
[2002-2-27 0:30:41] DEBUG [DEBUG]: poll: delay: 1014766251 (1014766241) 10000
Basically I just moved the code 'Ping timeout' code below the part
that checks if a PING was sent at all.
ChangeLog:
2002-02-27 Carlo Wood <[EMAIL PROTECTED]>
* /ircd/ircd.c: check_pings: First check if a PING was sent at all.
--
Carlo Wood <[EMAIL PROTECTED]>
Index: ircd.c
===================================================================
RCS file: /home/coder-com/cvs/ircu2.10/ircd/ircd.c,v
retrieving revision 1.53
diff -u -d -p -r1.53 ircd.c
--- ircd.c 2002/02/19 21:28:36 1.53
+++ ircd.c 2002/02/26 23:43:55
@@ -353,17 +353,6 @@ static void check_pings(struct Event* ev
continue;
}
- /* Quit the client after max_ping*2 - they should have answered by now */
- if (CurrentTime-cli_lasttime(cptr) >= (max_ping*2) ) {
- /* If it was a server, then tell ops about it. */
- if (IsServer(cptr) || IsConnecting(cptr) || IsHandshake(cptr))
- sendto_opmask_butone(0, SNO_OLDSNO,
- "No response from %s, closing link",
- cli_name(cptr));
- exit_client_msg(cptr, cptr, &me, "Ping timeout");
- continue;
- }
-
/* Unregistered clients pingout after max_ping seconds, they don't
* get given a second chance - if they were then people could not quite
* finish registration and hold resources without being subject to k/g
@@ -397,6 +386,17 @@ static void check_pings(struct Event* ev
sendrawto_one(cptr, MSG_PING " :%s", cli_name(&me));
else
sendcmdto_one(&me, CMD_PING, cptr, ":%s", cli_name(&me));
+ }
+
+ /* Quit the client after max_ping*2 - they should have answered by now */
+ if (CurrentTime-cli_lasttime(cptr) >= (max_ping*2) ) {
+ /* If it was a server, then tell ops about it. */
+ if (IsServer(cptr) || IsConnecting(cptr) || IsHandshake(cptr))
+ sendto_opmask_butone(0, SNO_OLDSNO,
+ "No response from %s, closing link",
+ cli_name(cptr));
+ exit_client_msg(cptr, cptr, &me, "Ping timeout");
+ continue;
}
expire = cli_lasttime(cptr) + max_ping * 2;