Changeset b958cb5


Ignore:
Timestamp:
2012-02-26T09:20:30Z (9 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
e371011
Parents:
441a67e
Message:

Changing ping behaviour. Pinging seems to be misbehaving for some people
for reasons not entirely clear to me. Instead of suppressing a PING to the
client if we're still waiting for a response to a previous one, just keep
sending them. One PONG will be enough to stay connected but that's okay.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc.c

    r441a67e rb958cb5  
    858858static gboolean irc_userping( gpointer _irc, gint fd, b_input_condition cond )
    859859{
     860        double now = gettime();
    860861        irc_t *irc = _irc;
    861         int rv = 0;
     862        int fail = 0;
    862863       
    863864        if( !( irc->status & USTATUS_LOGGED_IN ) )
    864865        {
    865                 if( gettime() > ( irc->last_pong + IRC_LOGIN_TIMEOUT ) )
    866                         rv = gettime() - irc->last_pong;
     866                if( now > ( irc->last_pong + IRC_LOGIN_TIMEOUT ) )
     867                        fail = now - irc->last_pong;
    867868        }
    868869        else
    869870        {
    870                 if( ( gettime() > ( irc->last_pong + global.conf->ping_interval ) ) && !irc->pinging )
     871                if( now > ( irc->last_pong + global.conf->ping_timeout ) )
     872                {
     873                        fail = now - irc->last_pong;
     874                }
     875                else
    871876                {
    872877                        irc_write( irc, "PING :%s", IRC_PING_STRING );
    873                         irc->pinging = 1;
    874                 }
    875                 else if( gettime() > ( irc->last_pong + global.conf->ping_timeout ) )
    876                 {
    877                         rv = gettime() - irc->last_pong;
    878                 }
    879         }
    880        
    881         if( rv > 0 )
    882         {
    883                 irc_abort( irc, 0, "Ping Timeout: %d seconds", rv );
     878                }
     879        }
     880       
     881        if( fail > 0 )
     882        {
     883                irc_abort( irc, 0, "Ping Timeout: %d seconds", fail );
    884884                return FALSE;
    885885        }
Note: See TracChangeset for help on using the changeset viewer.