mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 18:50:28 +09:00
socket: Call data handler as long as handler takes data.
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Aris Adamantiadis
parent
f17788adc2
commit
d7ab3d7b3d
@@ -280,10 +280,12 @@ int ssh_socket_pollcallback(struct ssh_poll_handle_struct *p, socket_t fd, int r
|
|||||||
/* Bufferize the data and then call the callback */
|
/* Bufferize the data and then call the callback */
|
||||||
buffer_add_data(s->in_buffer,buffer,r);
|
buffer_add_data(s->in_buffer,buffer,r);
|
||||||
if(s->callbacks && s->callbacks->data){
|
if(s->callbacks && s->callbacks->data){
|
||||||
|
do {
|
||||||
r= s->callbacks->data(buffer_get_rest(s->in_buffer),
|
r= s->callbacks->data(buffer_get_rest(s->in_buffer),
|
||||||
buffer_get_rest_len(s->in_buffer),
|
buffer_get_rest_len(s->in_buffer),
|
||||||
s->callbacks->userdata);
|
s->callbacks->userdata);
|
||||||
buffer_pass_bytes(s->in_buffer,r);
|
buffer_pass_bytes(s->in_buffer,r);
|
||||||
|
} while (r > 0);
|
||||||
/* p may have been freed, so don't use it
|
/* p may have been freed, so don't use it
|
||||||
* anymore in this function */
|
* anymore in this function */
|
||||||
p = NULL;
|
p = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user