aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/jabber/s5bytestream.c
diff options
context:
space:
mode:
authorulim <a.sporto+bee@gmail.com>2008-08-04 16:21:49 +0200
committerulim <a.sporto+bee@gmail.com>2008-08-04 16:21:49 +0200
commit4ac647dbcef152bebde7209f7c9cbbf8a5e0fc37 (patch)
treed845669fadf79af229e72230369078389b16cad8 /protocols/jabber/s5bytestream.c
parent8a90001ab2cde971abc64b8d5e4174dc4c4b0ae2 (diff)
moved some stuff around in preperation for MSN merge.
* both ends (proto&dcc) need to finish a transfer now for it to be finished * moved throughput calc. and some messages to dcc (no need to implement in protocols)
Diffstat (limited to 'protocols/jabber/s5bytestream.c')
-rw-r--r--protocols/jabber/s5bytestream.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/protocols/jabber/s5bytestream.c b/protocols/jabber/s5bytestream.c
index c492491b..7e4ca2ab 100644
--- a/protocols/jabber/s5bytestream.c
+++ b/protocols/jabber/s5bytestream.c
@@ -642,11 +642,11 @@ gboolean jabber_bs_recv_read( gpointer data, gint fd, b_input_condition cond )
if( ret == 0 )
return jabber_bs_abort( bt, "Remote end closed connection" );
- if( tf->bytesread == 0 )
- tf->ft->started = time( NULL );
-
tf->bytesread += ret;
+ if( tf->bytesread >= tf->ft->file_size )
+ imcb_file_finished( tf->ft );
+
tf->ft->write( tf->ft, tf->ft->buffer, ret );
return FALSE;
@@ -700,16 +700,16 @@ gboolean jabber_bs_send_write( file_transfer_t *ft, char *buffer, unsigned int l
/* TODO: catch broken pipe */
ASSERTSOCKOP( ret = send( tf->fd, buffer, len, 0 ), "Sending" );
- if( tf->byteswritten == 0 )
- tf->ft->started = time( NULL );
-
tf->byteswritten += ret;
/* TODO: this should really not be fatal */
if( ret < len )
return jabber_bs_abort( bt, "send() sent %d instead of %d (send buffer too big!)", ret, len );
- bt->tf->watch_out = b_input_add( tf->fd, GAIM_INPUT_WRITE, jabber_bs_send_can_write, bt );
+ if( tf->byteswritten >= ft->file_size )
+ imcb_file_finished( ft );
+ else
+ bt->tf->watch_out = b_input_add( tf->fd, GAIM_INPUT_WRITE, jabber_bs_send_can_write, bt );
return TRUE;
}