1
0
mirror of https://github.com/osmarks/ngircd.git synced 2025-03-04 08:28:10 +00:00

Send a PING at the end of the server sync to detect it

At the end of sending all "state" to the remote server, a PING command
is sent to request a PONG reply. Until then, no "regual" PING was sent,
so Conn_LastPing(<connection>) is null and now becomes non-null in the
PONG command handler.

So the servers are still synchronizing when Conn_LastPing(<connection>)
is 0, which could easily be tested.
This commit is contained in:
Alexander Barton 2012-01-24 02:46:12 +01:00
parent 5a200e1543
commit bc20f9ec10
2 changed files with 14 additions and 9 deletions

View File

@ -889,15 +889,16 @@ IRC_PONG(CLIENT *Client, REQUEST *Req)
} }
#endif #endif
#ifdef DEBUG if (Client_Type(Client) == CLIENT_SERVER && Conn_LastPing(conn) == 0) {
if (conn > NONE) Log(LOG_INFO,
Log(LOG_DEBUG, "Synchronization with \"%s\" done (connection %d): %ld seconds [%ld users, %ld channels]",
"Connection %d: received PONG. Lag: %ld seconds.", conn, Client_ID(Client), conn, time(NULL) - Conn_GetSignon(conn),
time(NULL) - Conn_LastPing(Client_Conn(Client))); Client_UserCount(), Channel_CountVisible(NULL));
else Conn_UpdatePing(conn);
Log(LOG_DEBUG, } else
"Connection %d: received PONG.", conn); LogDebug("Connection %d: received PONG. Lag: %ld seconds.",
#endif conn, time(NULL) - Conn_LastPing(conn));
return CONNECTED; return CONNECTED;
} /* IRC_PONG */ } /* IRC_PONG */

View File

@ -384,6 +384,10 @@ IRC_Num_ENDOFMOTD(CLIENT * Client, UNUSED REQUEST * Req)
} }
#endif #endif
if (!IRC_WriteStrClient(Client, "PING :%s",
Client_ID(Client_ThisServer())))
return DISCONNECTED;
return CONNECTED; return CONNECTED;
} /* IRC_Num_ENDOFMOTD */ } /* IRC_Num_ENDOFMOTD */