Changes in / [b8c2ace:55ec2d6]
Legend:
- Unmodified
- Added
- Removed
-
bitlbee.c
rb8c2ace r55ec2d6 133 133 if( condition & G_IO_ERR || condition & G_IO_HUP ) 134 134 { 135 irc_ free( irc);135 irc_abort( irc, 1, "Read error" ); 136 136 return FALSE; 137 137 } … … 140 140 if( st == 0 ) 141 141 { 142 irc_ free( irc);142 irc_abort( irc, 1, "Connection reset by peer" ); 143 143 return FALSE; 144 144 } … … 151 151 else 152 152 { 153 irc_ free( irc);153 irc_abort( irc, 1, "Read error: %s", strerror( errno ) ); 154 154 return FALSE; 155 155 } … … 177 177 if( irc->readbuffer && ( strlen( irc->readbuffer ) > 1024 ) ) 178 178 { 179 log_message( LOGLVL_ERROR, "Maximum line length exceeded." ); 180 irc_abort( irc ); 179 irc_abort( irc, 0, "Maximum line length exceeded" ); 181 180 return FALSE; 182 181 } … … 199 198 if( st == 0 || ( st < 0 && !sockerr_again() ) ) 200 199 { 201 irc_ free( irc);200 irc_abort( irc, 1, "Write error: %s", strerror( errno ) ); 202 201 return FALSE; 203 202 } -
irc.c
rb8c2ace r55ec2d6 152 152 } 153 153 154 void irc_abort( irc_t *irc ) 155 { 154 void irc_abort( irc_t *irc, int immed, char *format, ... ) 155 { 156 va_list params; 157 158 if( format != NULL ) 159 { 160 char *reason; 161 162 va_start( params, format ); 163 reason = g_strdup_printf( format, params ); 164 va_end( params ); 165 166 if( !immed ) 167 irc_write( irc, "ERROR :Closing link: %s", reason ); 168 169 ipc_to_master_str( "OPERMSG :Client exiting: %s@%s [%s]\r\n", 170 irc->nick, irc->host, reason" ); 171 172 g_free( reason ); 173 } 174 else 175 { 176 if( !immed ) 177 irc_write( irc, "ERROR :Closing link" ); 178 179 ipc_to_master_str( "OPERMSG :Client exiting: %s@%s [%s]\r\n", 180 irc->nick, irc->host, "No reason given" ); 181 } 182 156 183 irc->status = USTATUS_SHUTDOWN; 157 if( irc->sendbuffer ) 158 { 184 if( irc->sendbuffer && !immed ) 185 { 186 /* We won't read from this socket anymore. Instead, we'll connect a timer 187 to it that should shut down the connection in a second, just in case 188 bitlbee_.._write doesn't do it first. */ 189 159 190 g_source_remove( irc->r_watch_source_id ); 160 191 irc->r_watch_source_id = g_timeout_add_full( G_PRIORITY_HIGH, 1000, (GSourceFunc) irc_free, irc, NULL ); … … 1115 1146 if( rv > 0 ) 1116 1147 { 1117 irc_write( irc, "ERROR :Closing Link: Ping Timeout: %d seconds", rv ); 1118 irc_free( irc ); 1148 irc_abort( irc, "ERROR :Closing Link: Ping Timeout: %d seconds", rv ); 1119 1149 return FALSE; 1120 1150 } -
irc.h
rb8c2ace r55ec2d6 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.