Commit a83140a5 authored by Ghislain MARY's avatar Ghislain MARY

Fix bug causing the file_recv callback to be called with a size of 0 before...

Fix bug causing the file_recv callback to be called with a size of 0 before the file transfer even started.
parent 3ba68af2
......@@ -346,9 +346,16 @@ static int acquire_body_simple(belle_sip_channel_t *obj, int end_of_stream){
belle_sip_body_handler_t *bh=belle_sip_message_get_body_handler(msg);
size_t cursize=belle_sip_body_handler_get_transfered_size(bh);
to_read=MIN(content_length-cursize, to_read);
if ((cursize == 0) && (to_read == 0)) {
/**
* No data has been received yet, so do not call feed_body() with a size
* of 0 that is meaning that the transfer is finished.
*/
} else {
to_read=MIN(content_length-cursize, to_read);
feed_body(obj,to_read);
}
feed_body(obj,to_read);
if (end_of_stream || belle_sip_body_handler_get_transfered_size(bh)>=content_length){
/*great body completed
belle_sip_message("channel [%p] read [%i] bytes of body from %s:%i\n%s" ,obj
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment