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 /irc.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 'irc.c')
-rw-r--r-- | irc.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -150,6 +150,20 @@ irc_t *irc_new( int fd ) return( irc ); } +void irc_abort( irc_t *irc ) +{ + irc->status = USTATUS_SHUTDOWN; + if( irc->sendbuffer ) + { + g_source_remove( irc->r_watch_source_id ); + irc->r_watch_source_id = g_timeout_add_full( G_PRIORITY_HIGH, 1000, (GSourceFunc) irc_free, irc, NULL ); + } + else + { + irc_free( irc ); + } +} + static gboolean irc_free_userhash( gpointer key, gpointer value, gpointer data ) { g_free( key ); @@ -158,7 +172,7 @@ static gboolean irc_free_userhash( gpointer key, gpointer value, gpointer data ) } /* Because we have no garbage collection, this is quite annoying */ -void irc_free(irc_t * irc) +void irc_free( irc_t * irc ) { account_t *account, *accounttmp; user_t *user, *usertmp; @@ -495,7 +509,7 @@ int irc_exec( irc_t *irc, char **cmd ) else if( g_strcasecmp( cmd[0], "QUIT" ) == 0 ) { irc_write( irc, "ERROR :%s%s", cmd[1]?"Quit: ":"", cmd[1]?cmd[1]:"Client Quit" ); - g_io_channel_close( irc->io_channel ); + /* g_io_channel_close( irc->io_channel ); */ return( 0 ); } |