diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2006-01-18 23:15:09 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2006-01-18 23:15:09 +0100 |
commit | 92ad3d44da447199f45dbc438d061cc4e2261dbd (patch) | |
tree | 5475751130daa05a9b4e2615cc29fb769b6e392d /bitlbee.c | |
parent | d9909972078956f7f362ba479cc22250cc6e1b13 (diff) | |
parent | c1826c6f72d1fe85e1c5decf5207601dac2c23e7 (diff) |
Merging changes from laptop: Now tries to empty sendbuffer before closing the connection,
and fixed some error checking flaw in bitlbee_io_current_client_write() that was also
present in the _read() version before 0.99 (and actually caused the 100% CPU bug that kept
us from releasing 1.0).
Diffstat (limited to 'bitlbee.c')
-rw-r--r-- | bitlbee.c | 26 |
1 files changed, 13 insertions, 13 deletions
@@ -199,7 +199,7 @@ gboolean bitlbee_io_current_client_read( GIOChannel *source, GIOCondition condit if( !irc_process( irc ) ) { log_message( LOGLVL_INFO, "Destroying connection with fd %d.", irc->fd ); - irc_free( irc ); + irc_abort( irc ); return FALSE; } @@ -207,7 +207,7 @@ gboolean bitlbee_io_current_client_read( GIOChannel *source, GIOCondition condit if( irc->readbuffer && ( strlen( irc->readbuffer ) > 1024 ) ) { log_message( LOGLVL_ERROR, "Maximum line length exceeded." ); - irc_free( irc ); + irc_abort( irc ); return FALSE; } @@ -226,25 +226,25 @@ gboolean bitlbee_io_current_client_write( GIOChannel *source, GIOCondition condi size = strlen( irc->sendbuffer ); st = write( irc->fd, irc->sendbuffer, size ); - if( st <= 0 ) + if( st == 0 || ( st < 0 && !sockerr_again() ) ) { - if( sockerr_again() ) - { - return TRUE; - } - else - { - irc_free( irc ); - return FALSE; - } + irc_free( irc ); + return FALSE; + } + else if( st < 0 ) /* && sockerr_again() */ + { + return TRUE; } if( st == size ) { g_free( irc->sendbuffer ); irc->sendbuffer = NULL; - irc->w_watch_source_id = 0; + + if( irc->status == USTATUS_SHUTDOWN ) + irc_free( irc ); + return( FALSE ); } else |