Changeset d56ee38
- Timestamp:
- 2008-05-06T00:20:11Z (17 years ago)
- Branches:
- master
- Children:
- 44961cb
- Parents:
- 29c1456
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
dcc.c
r29c1456 rd56ee38 85 85 gboolean dccs_recv_proto( gpointer data, gint fd, b_input_condition cond); 86 86 gboolean dccs_recv_write_request( file_transfer_t *ft ); 87 gboolean dcc_progress( gpointer data, gint fd, b_input_condition cond ); 87 88 88 89 /* As defined in ft.h */ … … 152 153 df->ic->irc->file_transfers = g_slist_prepend( df->ic->irc->file_transfers, file ); 153 154 155 df->progress_timeout = b_timeout_add( DCC_MAX_STALL * 1000, dcc_progress, df ); 156 154 157 return file; 155 158 } … … 168 171 if( file->canceled ) 169 172 file->canceled( file, msg ); 170 else 171 imcb_log( df->ic, "DCC transfer aborted: %s", msg );173 174 imcb_log( df->ic, "File %s: DCC transfer aborted: %s", file->file_name, msg ); 172 175 173 176 g_free( msg ); … … 176 179 177 180 return FALSE; 181 } 182 183 gboolean dcc_progress( gpointer data, gint fd, b_input_condition cond ) 184 { 185 struct dcc_file_transfer *df = data; 186 187 if( df->ft->bytes_transferred == df->progress_bytes_last ) 188 { 189 /* no progress. cancel */ 190 if( df->bytes_sent == 0 ) 191 return dcc_abort( df, "Couldnt establish transfer within %d seconds", DCC_MAX_STALL ); 192 else 193 return dcc_abort( df, "Transfer stalled for %d seconds at %d kb", DCC_MAX_STALL, df->ft->bytes_transferred / 1024 ); 194 195 } 196 197 df->progress_bytes_last = df->ft->bytes_transferred; 198 199 return TRUE; 178 200 } 179 201 … … 435 457 ft->write_request = dccs_recv_write_request; 436 458 459 df->progress_timeout = b_timeout_add( DCC_MAX_STALL * 1000, dcc_progress, df ); 460 437 461 return TRUE; 438 462 } … … 573 597 if( df->watch_out ) 574 598 b_event_remove( df->watch_out ); 599 600 if( df->progress_timeout ) 601 b_event_remove( df->progress_timeout ); 575 602 576 603 df->ic->irc->file_transfers = g_slist_remove( df->ic->irc->file_transfers, file ); -
dcc.h
r29c1456 rd56ee38 47 47 #define DCC_PACKET_SIZE 1024 48 48 49 /* Time in seconds that a DCC transfer can be stalled before being aborted. 50 * By handling this here individual protocols don't have to think about this. */ 51 #define DCC_MAX_STALL 120 52 49 53 typedef struct dcc_file_transfer { 50 54 … … 64 68 gint watch_out; /* writable */ 65 69 70 /* the progress watcher cancels any file transfer if nothing happens within DCC_MAX_STALL */ 71 gint progress_timeout; 72 size_t progress_bytes_last; 73 66 74 /* 67 75 * The total amount of bytes that have been sent to the irc client. -
protocols/jabber/si.c
r29c1456 rd56ee38 55 55 { 56 56 struct jabber_transfer *tf = ft->data; 57 58 imcb_log( tf->ic, "File %s transferred successfully!" , ft->file_name ); 57 time_t diff = time( NULL ) - ft->started; 58 59 imcb_log( tf->ic, "File %s transferred successfully at %d kb/s!" , ft->file_name, (int) ( ft->bytes_transferred / 1024 / diff ) ); 59 60 } 60 61
Note: See TracChangeset
for help on using the changeset viewer.