Change cancel method for wxWebRequestCURL objects

Previously wxWebRequestCURL objects were canceled by removing their
CURL easy handle from the CURLM multihandle. Unfortunately the really
only pauses the connection and does not truly cancel it. This commit
tries to stop the transfer by retrieving the active socket from the CURL
handle for the transfer and closing it.

There are some complications in doing this because the option curl uses
to get the socket have changed over the years. A combination of compile
time and run time checks are used to use the appropriate options to get
the socket. However in the case of 64bit windows using a curl version
older than 7.45.0 simply won’t have an usable option. In this case,
it seems nothing can be done.
This commit is contained in:
New Pagodi
2021-02-07 16:34:07 -06:00
parent 774a752bed
commit 88dca37b3f
2 changed files with 66 additions and 0 deletions

View File

@@ -167,6 +167,7 @@ private:
void ProcessSocketCallback(curl_socket_t, int);
void ProcessSocketPollerResult(wxThreadEvent&);
void CheckForCompletedTransfers();
void StopTransfer(CURL*);
WX_DECLARE_HASH_MAP(CURL*, wxWebRequestCURL*, wxPointerHash, \
wxPointerEqual, TransferSet);