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:
Daniel Stenberg
2012-05-12 22:37:20 +02:00
parent 62901253a4
commit a123051200

View File

@@ -430,10 +430,6 @@ static void sftp_packetlist_flush(LIBSSH2_SFTP_HANDLE *handle)
int rc;
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,
chunk->request_id, &data, &data_len);
if(rc)
@@ -443,6 +439,10 @@ static void sftp_packetlist_flush(LIBSSH2_SFTP_HANDLE *handle)
if(!rc)
/* we found a packet, free it */
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_FREE(session, chunk);