Record active sockets in wxWebSessionCURL
If a wxWebRequestCURL object is canceled or deleted before its transfer is complete, we need to manually close its active socket. Record each transfer’s active socket in wxWebSessionCURL::SocketCallback so can use it if needed. Previously, this was done using curl_easy_getinfo, but this required some compile time and run time checks and could fail in some specific cases. Recording the socket ourselves significantly simplifies the code and should always work.
This commit is contained in:
@@ -168,12 +168,17 @@ private:
|
||||
void ProcessSocketPollerResult(wxThreadEvent&);
|
||||
void CheckForCompletedTransfers();
|
||||
void FailRequest(CURL*, const wxString&);
|
||||
void StopTransfer(CURL*);
|
||||
void StopActiveTransfer(CURL*);
|
||||
void RemoveActiveSocket(CURL*);
|
||||
|
||||
WX_DECLARE_HASH_MAP(CURL*, wxWebRequestCURL*, wxPointerHash, \
|
||||
wxPointerEqual, TransferSet);
|
||||
|
||||
WX_DECLARE_HASH_MAP(CURL*, curl_socket_t, wxPointerHash, \
|
||||
wxPointerEqual, CurlSocketMap);
|
||||
|
||||
TransferSet m_activeTransfers;
|
||||
CurlSocketMap m_activeSockets;
|
||||
|
||||
SocketPoller* m_socketPoller;
|
||||
wxTimer m_timeoutTimer;
|
||||
|
Reference in New Issue
Block a user