mirror of
https://github.com/curl/curl.git
synced 2026-08-25 01:33:31 +03:00
FTP: close callback fix
Keep track of which sockets that are the result of accept() calls and refuse to call the closesocket callback for those sockets. Test case 596 now verifies that the open socket callback is called the same number of times as the closed socket callback for active FTP connections. Bug: http://curl.haxx.se/mail/lib-2011-12/0018.html Reported by: Gokhan Sengun
This commit is contained in:
parent
088ba97a24
commit
d5b5f64bce
4 changed files with 11 additions and 6 deletions
|
|
@ -1110,10 +1110,14 @@ curl_socket_t Curl_getconnectinfo(struct SessionHandle *data,
|
|||
int Curl_closesocket(struct connectdata *conn,
|
||||
curl_socket_t sock)
|
||||
{
|
||||
if(conn && conn->fclosesocket)
|
||||
return conn->fclosesocket(conn->closesocket_client, sock);
|
||||
else
|
||||
return sclose(sock);
|
||||
if(conn && conn->fclosesocket) {
|
||||
if((sock != conn->sock[SECONDARYSOCKET]) ||
|
||||
!conn->sock_accepted[SECONDARYSOCKET])
|
||||
/* if this socket matches the second socket, and that was created with
|
||||
accept, then we MUST NOT call the callback */
|
||||
return conn->fclosesocket(conn->closesocket_client, sock);
|
||||
}
|
||||
return sclose(sock);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue