- Timestamp:
- 2009-12-13T14:48:56Z (15 years ago)
- Branches:
- master
- Children:
- e8c8d00
- Parents:
- 2288705
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
dcc.c
r2288705 r1c3008a 115 115 { 116 116 file_transfer_t *file = g_new0( file_transfer_t, 1 ); 117 dcc_file_transfer_t *df = file->priv = g_new0( dcc_file_transfer_t, 1); 117 dcc_file_transfer_t *df = file->priv = g_new0( dcc_file_transfer_t, 1 ); 118 118 119 file->file_size = file_size; 119 120 file->file_name = g_strdup( file_name ); … … 144 145 /* listen and request */ 145 146 146 if( ( df->fd = ft_listen( &saddr, host, port, TRUE, &errmsg ) ) == -1 ) { 147 if( ( df->fd = ft_listen( &saddr, host, port, TRUE, &errmsg ) ) == -1 ) 148 { 147 149 dcc_abort( df, "Failed to listen locally, check your ft_listen setting in bitlbee.conf: %s", errmsg ); 148 150 return NULL; … … 161 163 df->progress_timeout = b_timeout_add( DCC_MAX_STALL * 1000, dcc_progress, df ); 162 164 163 imcb_log( ic, "File transfer request from %s for %s (%zd kb). ", user_nick, file_name, file_size/1024 ); 164 165 imcb_log( ic, "Accept the file transfer if you'd like the file. If you don't, issue the 'transfers reject' command."); 165 imcb_log( ic, "File transfer request from %s for %s (%zd kb).\n" 166 "Accept the file transfer if you'd like the file. If you don't, " 167 "issue the 'transfers reject' command.", 168 user_nick, file_name, file_size / 1024 ); 166 169 167 170 return file; … … 199 202 /* no progress. cancel */ 200 203 if( df->bytes_sent == 0 ) 201 return dcc_abort( df, "Couldn t establish transfer within %d seconds", DCC_MAX_STALL );204 return dcc_abort( df, "Couldn't establish transfer within %d seconds", DCC_MAX_STALL ); 202 205 else 203 206 return dcc_abort( df, "Transfer stalled for %d seconds at %d kb", DCC_MAX_STALL, df->bytes_sent / 1024 ); … … 230 233 ntohl( saddr_ipv4->sin_addr.s_addr ) ); 231 234 port = saddr_ipv4->sin_port; 232 } else 235 } 236 else 233 237 { 234 238 struct sockaddr_in6 *saddr_ipv6 = ( struct sockaddr_in6 *) saddr; … … 250 254 251 255 if ( !irc_msgfrom( df->ic->irc, user_nick, cmd ) ) 252 return dcc_abort( df, " couldn't send 'DCC SEND' message to %s", user_nick );256 return dcc_abort( df, "Couldn't send `DCC SEND' message to %s.", user_nick ); 253 257 254 258 g_free( cmd ); … … 313 317 short revents; 314 318 315 if( !dcc_poll( df, fd, &revents ) )319 if( !dcc_poll( df, fd, &revents ) ) 316 320 return FALSE; 317 321 … … 349 353 int ret; 350 354 351 ASSERTSOCKOP( ret = recv( fd, &bytes_received, sizeof( bytes_received 355 ASSERTSOCKOP( ret = recv( fd, &bytes_received, sizeof( bytes_received ), MSG_PEEK ), "Receiving" ); 352 356 353 357 if( ret == 0 ) … … 356 360 if( ret < 4 ) 357 361 { 358 imcb_log( df->ic, "WARNING: DCC SEND: receiver sent only 2 bytes instead of 4, shouldn't happen too often!");362 imcb_log( df->ic, "WARNING: DCC SEND: receiver sent only %d bytes instead of 4, shouldn't happen too often!", ret ); 359 363 return TRUE; 360 364 } 361 365 362 ASSERTSOCKOP( ret = recv( fd, &bytes_received, sizeof( bytes_received 366 ASSERTSOCKOP( ret = recv( fd, &bytes_received, sizeof( bytes_received ), 0 ), "Receiving" ); 363 367 if( ret != 4 ) 364 368 return dcc_abort( df, "MSG_PEEK'ed 4, but can only dequeue %d bytes", ret ); … … 400 404 return dcc_abort( df, "BUG: protocol didn't register write()" ); 401 405 402 ASSERTSOCKOP( fd = df->fd = socket( saddr->ss_family, SOCK_STREAM, 0 ) 406 ASSERTSOCKOP( fd = df->fd = socket( saddr->ss_family, SOCK_STREAM, 0 ), "Opening Socket" ); 403 407 404 408 sock_make_nonblocking( fd ); … … 429 433 } 430 434 431 gboolean dccs_recv_proto( gpointer data, gint fd, b_input_condition cond )435 gboolean dccs_recv_proto( gpointer data, gint fd, b_input_condition cond ) 432 436 { 433 437 dcc_file_transfer_t *df = data;
Note: See TracChangeset
for help on using the changeset viewer.