Less magic numbers for timeout settings

Currently the connection timeout handling of znc uses three magic numbers, each
of which is at least repeated in two unrelated places. This commits defines the
numbers in CIRCNetwork and makes the other places just use this number.

This also renames PING_TIMEOUT to PING_FREQUENCY because I feel that describes
this constant better.

I am not really happy about the name NO_TRAFFIC_TIMEOUT that is used for the
real timeout, but I couldn't think of a better name. PING_TIMEOUT isn't good
because that sounds like the time between sending a PING and the resulting
timeout.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter
2014-07-14 15:33:36 +02:00
parent 154bf9fdd6
commit ba11b8eecf
5 changed files with 15 additions and 8 deletions

View File

@@ -671,7 +671,7 @@ void CClient::AcceptLogin(CUser& User) {
// Set our proper timeout and set back our proper timeout mode
// (constructor set a different timeout and mode)
SetTimeout(540, TMO_READ);
SetTimeout(CIRCNetwork::NO_TRAFFIC_TIMEOUT, TMO_READ);
SetSockName("USR::" + m_pUser->GetUserName());
SetEncoding(m_pUser->GetClientEncoding());