FTP: call opensocket callback properly

When the new socket is created for an active connection, it is now done
using the open socket callback.

Test case 596 was modified to run fine, although it hides the fact that
the close callback is still called too many times, as it also gets
called for closing sockets that were created with accept().
This commit is contained in:
Daniel Stenberg
2011-12-05 11:42:10 +01:00
parent 9109cdec11
commit 088ba97a24
4 changed files with 23 additions and 20 deletions

View File

@@ -294,10 +294,9 @@ argument in the sockopt callback set with \fICURLOPT_SOCKOPTFUNCTION\fP.
Function pointer that should match the \fIcurl_opensocket_callback\fP
prototype found in \fI<curl/curl.h>\fP. This function gets called by libcurl
instead of the \fIsocket(2)\fP call. The callback's \fIpurpose\fP argument
identifies the exact purpose for this particular socket, and currently only
one value is supported: \fICURLSOCKTYPE_IPCXN\fP for the primary connection
(meaning the control connection in the FTP case). Future versions of libcurl
may support more purposes. It passes the resolved peer address as a
identifies the exact purpose for this particular socket:
\fICURLSOCKTYPE_IPCXN\fP is for IP based connections. Future versions of
libcurl may support more purposes. It passes the resolved peer address as a
\fIaddress\fP argument so the callback can modify the address or refuse to
connect at all. The callback function should return the socket or
\fICURL_SOCKET_BAD\fP in case no connection should be established or any error