Changes in / [55ec2d6:b8c2ace]
Legend:
- Unmodified
- Added
- Removed
-
bitlbee.c
r55ec2d6 rb8c2ace 133 133 if( condition & G_IO_ERR || condition & G_IO_HUP ) 134 134 { 135 irc_ abort( irc, 1, "Read error");135 irc_free( irc ); 136 136 return FALSE; 137 137 } … … 140 140 if( st == 0 ) 141 141 { 142 irc_ abort( irc, 1, "Connection reset by peer");142 irc_free( irc ); 143 143 return FALSE; 144 144 } … … 151 151 else 152 152 { 153 irc_ abort( irc, 1, "Read error: %s", strerror( errno ));153 irc_free( irc ); 154 154 return FALSE; 155 155 } … … 177 177 if( irc->readbuffer && ( strlen( irc->readbuffer ) > 1024 ) ) 178 178 { 179 irc_abort( irc, 0, "Maximum line length exceeded" ); 179 log_message( LOGLVL_ERROR, "Maximum line length exceeded." ); 180 irc_abort( irc ); 180 181 return FALSE; 181 182 } … … 198 199 if( st == 0 || ( st < 0 && !sockerr_again() ) ) 199 200 { 200 irc_ abort( irc, 1, "Write error: %s", strerror( errno ));201 irc_free( irc ); 201 202 return FALSE; 202 203 } -
irc.c
r55ec2d6 rb8c2ace 152 152 } 153 153 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 154 void irc_abort( irc_t *irc ) 155 { 183 156 irc->status = USTATUS_SHUTDOWN; 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 157 if( irc->sendbuffer ) 158 { 190 159 g_source_remove( irc->r_watch_source_id ); 191 160 irc->r_watch_source_id = g_timeout_add_full( G_PRIORITY_HIGH, 1000, (GSourceFunc) irc_free, irc, NULL ); … … 1146 1115 if( rv > 0 ) 1147 1116 { 1148 irc_abort( irc, "ERROR :Closing Link: Ping Timeout: %d seconds", rv ); 1117 irc_write( irc, "ERROR :Closing Link: Ping Timeout: %d seconds", rv ); 1118 irc_free( irc ); 1149 1119 return FALSE; 1150 1120 } -
irc.h
r55ec2d6 rb8c2ace 105 105 106 106 irc_t *irc_new( int fd ); 107 void irc_abort( irc_t *irc , int immed, char *format, ...);107 void irc_abort( irc_t *irc ); 108 108 void irc_free( irc_t *irc ); 109 109
Note: See TracChangeset
for help on using the changeset viewer.