sftp_close_handle: packet list is generic

Fix comment, simplify the loop logic
This commit is contained in:
Daniel Stenberg 2010-12-14 09:33:58 +01:00
parent 1b65c6ae26
commit c1683ae92c

View File

@ -1933,17 +1933,15 @@ sftp_close_handle(LIBSSH2_SFTP_HANDLE *handle)
if(handle->u.file.data)
LIBSSH2_FREE(session, handle->u.file.data);
}
/* remove pending write chunks */
do {
chunk = _libssh2_list_first(&handle->packet_list);
if(chunk) {
struct sftp_write_chunk *next =
_libssh2_list_next(&chunk->node);
_libssh2_list_remove(&chunk->node);
LIBSSH2_FREE(session, chunk);
chunk = next;
}
} while(chunk);
/* remove pending packets, if any */
chunk = _libssh2_list_first(&handle->packet_list);
while(chunk) {
struct sftp_write_chunk *next =
_libssh2_list_next(&chunk->node);
_libssh2_list_remove(&chunk->node);
LIBSSH2_FREE(session, chunk);
chunk = next;
}
handle->close_state = libssh2_NB_state_idle;