sftp_packetlist_flush: zombies must not have responses already
When flushing the packetlist, we must only add the request as a zombie if no response has already been received. Otherwise we could wrongly make it a zombie even though the response was already received and then we'd get a zombie stuck there "forever"...
This commit is contained in:
@@ -430,10 +430,6 @@ static void sftp_packetlist_flush(LIBSSH2_SFTP_HANDLE *handle)
|
|||||||
int rc;
|
int rc;
|
||||||
struct sftp_pipeline_chunk *next = _libssh2_list_next(&chunk->node);
|
struct sftp_pipeline_chunk *next = _libssh2_list_next(&chunk->node);
|
||||||
|
|
||||||
/* mark this request as a zombie if it ever sent anything */
|
|
||||||
if(chunk->sent)
|
|
||||||
add_zombie_request(sftp, chunk->request_id);
|
|
||||||
|
|
||||||
rc = sftp_packet_ask(sftp, SSH_FXP_STATUS,
|
rc = sftp_packet_ask(sftp, SSH_FXP_STATUS,
|
||||||
chunk->request_id, &data, &data_len);
|
chunk->request_id, &data, &data_len);
|
||||||
if(rc)
|
if(rc)
|
||||||
@@ -443,6 +439,10 @@ static void sftp_packetlist_flush(LIBSSH2_SFTP_HANDLE *handle)
|
|||||||
if(!rc)
|
if(!rc)
|
||||||
/* we found a packet, free it */
|
/* we found a packet, free it */
|
||||||
LIBSSH2_FREE(session, data);
|
LIBSSH2_FREE(session, data);
|
||||||
|
else if(chunk->sent)
|
||||||
|
/* there was no incoming packet for this request, mark this
|
||||||
|
request as a zombie if it ever sent the request */
|
||||||
|
add_zombie_request(sftp, chunk->request_id);
|
||||||
|
|
||||||
_libssh2_list_remove(&chunk->node);
|
_libssh2_list_remove(&chunk->node);
|
||||||
LIBSSH2_FREE(session, chunk);
|
LIBSSH2_FREE(session, chunk);
|
||||||
|
Reference in New Issue
Block a user