Mercurial > pidgin
diff libpurple/protocols/mxit/protocol.c @ 31492:7c3b4002f46e
* fixed crash caused by entering a wrong password (tx queue management)
| author | pieter.loubser@mxit.com |
|---|---|
| date | Fri, 25 Mar 2011 08:33:12 +0000 |
| parents | 671113b90ff6 |
| children | dde6f5770cd0 |
line wrap: on
line diff
--- a/libpurple/protocols/mxit/protocol.c Wed Mar 23 14:28:07 2011 +0000 +++ b/libpurple/protocols/mxit/protocol.c Fri Mar 25 08:33:12 2011 +0000 @@ -541,22 +541,25 @@ * it does not send messages too fast otherwise mxit will ignore the user for 30 seconds. * this is what we are trying to avoid here.. */ - if ( session->last_tx > ( now - MXIT_TX_DELAY ) ) { - /* we need to wait a little before sending the next packet, so schedule a wakeup call */ - gint64 tdiff = now - ( session->last_tx ); - guint delay = ( MXIT_TX_DELAY - tdiff ) + 9; - if ( delay <= 0 ) - delay = MXIT_TX_DELAY; - purple_timeout_add( delay, mxit_manage_queue_fast, session ); - } - else { - /* get the next packet from the queue to send */ - packet = pop_tx_packet( session ); - if ( packet != NULL ) { - /* there was a packet waiting to be sent to the server, now is the time to do something about it */ - - /* send the packet to MXit server */ - mxit_send_packet( session, packet ); + if ( session->q_fast_timer_id == 0 ) { + /* the fast timer has not been set yet */ + if ( session->last_tx > ( now - MXIT_TX_DELAY ) ) { + /* we need to wait a little before sending the next packet, so schedule a wakeup call */ + gint64 tdiff = now - ( session->last_tx ); + guint delay = ( MXIT_TX_DELAY - tdiff ) + 9; + if ( delay <= 0 ) + delay = MXIT_TX_DELAY; + session->q_fast_timer_id = purple_timeout_add( delay, mxit_manage_queue_fast, session ); + } + else { + /* get the next packet from the queue to send */ + packet = pop_tx_packet( session ); + if ( packet != NULL ) { + /* there was a packet waiting to be sent to the server, now is the time to do something about it */ + + /* send the packet to MXit server */ + mxit_send_packet( session, packet ); + } } } } @@ -587,6 +590,7 @@ { struct MXitSession* session = (struct MXitSession*) user_data; + session->q_fast_timer_id = 0; mxit_manage_queue( session ); /* stop running */ @@ -2646,9 +2650,13 @@ if ( session->http_timer_id > 0 ) purple_timeout_remove( session->http_timer_id ); - /* remove queue manager timer */ - if ( session->q_timer > 0 ) - purple_timeout_remove( session->q_timer ); + /* remove slow queue manager timer */ + if ( session->q_slow_timer_id > 0 ) + purple_timeout_remove( session->q_slow_timer_id ); + + /* remove fast queue manager timer */ + if ( session->q_fast_timer_id > 0 ) + purple_timeout_remove( session->q_fast_timer_id ); /* remove all groupchat rooms */ while ( session->rooms != NULL ) {
