Changeset fc50d48
- Timestamp:
- 2006-01-20T12:21:24Z (19 years ago)
- Branches:
- master
- Children:
- 55ec2d6
- Parents:
- 2fa825b
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
bitlbee.c
r2fa825b rfc50d48 163 163 if( condition & G_IO_ERR || condition & G_IO_HUP ) 164 164 { 165 irc_ free( irc);165 irc_abort( irc, 1, "Read error" ); 166 166 return FALSE; 167 167 } … … 170 170 if( st == 0 ) 171 171 { 172 irc_ free( irc);172 irc_abort( irc, 1, "Connection reset by peer" ); 173 173 return FALSE; 174 174 } … … 181 181 else 182 182 { 183 irc_ free( irc);183 irc_abort( irc, 1, "Read error: %s", strerror( errno ) ); 184 184 return FALSE; 185 185 } … … 207 207 if( irc->readbuffer && ( strlen( irc->readbuffer ) > 1024 ) ) 208 208 { 209 log_message( LOGLVL_ERROR, "Maximum line length exceeded." ); 210 irc_abort( irc ); 209 irc_abort( irc, 0, "Maximum line length exceeded" ); 211 210 return FALSE; 212 211 } … … 229 228 if( st == 0 || ( st < 0 && !sockerr_again() ) ) 230 229 { 231 irc_ free( irc);230 irc_abort( irc, 1, "Write error: %s", strerror( errno ) ); 232 231 return FALSE; 233 232 } -
irc.c
r2fa825b rfc50d48 151 151 } 152 152 153 void irc_abort( irc_t *irc ) 154 { 153 void irc_abort( irc_t *irc, int immed, char *format, ... ) 154 { 155 va_list params; 156 157 if( format != NULL ) 158 { 159 char *reason; 160 161 va_start( params, format ); 162 reason = g_strdup_printf( format, params ); 163 va_end( params ); 164 165 if( !immed ) 166 irc_write( irc, "ERROR :Closing link: %s", reason ); 167 168 ipc_to_master_str( "OPERMSG :Client exiting: %s@%s [%s]\r\n", 169 irc->nick, irc->host, reason" ); 170 171 g_free( reason ); 172 } 173 else 174 { 175 if( !immed ) 176 irc_write( irc, "ERROR :Closing link" ); 177 178 ipc_to_master_str( "OPERMSG :Client exiting: %s@%s [%s]\r\n", 179 irc->nick, irc->host, "No reason given" ); 180 } 181 155 182 irc->status = USTATUS_SHUTDOWN; 156 if( irc->sendbuffer ) 157 { 183 if( irc->sendbuffer && !immed ) 184 { 185 /* We won't read from this socket anymore. Instead, we'll connect a timer 186 to it that should shut down the connection in a second, just in case 187 bitlbee_.._write doesn't do it first. */ 188 158 189 g_source_remove( irc->r_watch_source_id ); 159 190 irc->r_watch_source_id = g_timeout_add_full( G_PRIORITY_HIGH, 1000, (GSourceFunc) irc_free, irc, NULL ); … … 1623 1654 if( rv > 0 ) 1624 1655 { 1625 irc_write( irc, "ERROR :Closing Link: Ping Timeout: %d seconds", rv ); 1626 irc_free( irc ); 1656 irc_abort( irc, "ERROR :Closing Link: Ping Timeout: %d seconds", rv ); 1627 1657 return FALSE; 1628 1658 } -
irc.h
r2fa825b rfc50d48 105 105 106 106 irc_t *irc_new( int fd ); 107 void irc_abort( irc_t *irc );107 void irc_abort( irc_t *irc, int immed, char *format, ... ); 108 108 void irc_free( irc_t *irc ); 109 109
Note: See TracChangeset
for help on using the changeset viewer.