diff options
author | George Hazan <george.hazan@gmail.com> | 2014-12-21 21:08:28 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-12-21 21:08:28 +0000 |
commit | aba0e4dc3f85c83fa3beb0d79d494857d83e25bf (patch) | |
tree | c9fab8bbe91a86dadc5c79114f6b9e0878311a78 /src/modules/netlib/netlib.cpp | |
parent | 096a1529d9d3a3fd7a1c5a05dae18a9e89678566 (diff) |
SSL context double shutdown prevention
git-svn-id: http://svn.miranda-ng.org/main/trunk@11567 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/netlib/netlib.cpp')
-rw-r--r-- | src/modules/netlib/netlib.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/modules/netlib/netlib.cpp b/src/modules/netlib/netlib.cpp index 320876ff20..e6fe71ada1 100644 --- a/src/modules/netlib/netlib.cpp +++ b/src/modules/netlib/netlib.cpp @@ -279,7 +279,7 @@ INT_PTR NetlibCloseHandle(WPARAM wParam, LPARAM) HttpGatewayRemovePacket(nlc, -1);
else {
if (nlc->s != INVALID_SOCKET)
- NetlibDoClose(nlc);
+ NetlibDoClose(nlc, nlc->termRequested);
if (nlc->s2 != INVALID_SOCKET) closesocket(nlc->s2);
nlc->s2 = INVALID_SOCKET;
}
@@ -389,18 +389,20 @@ INT_PTR NetlibShutdown(WPARAM wParam, LPARAM) switch(GetNetlibHandleType((void*)wParam)) {
case NLH_CONNECTION:
{
- struct NetlibConnection* nlc = (struct NetlibConnection*)wParam;
- if (nlc->hSsl) si.shutdown(nlc->hSsl);
- if (nlc->s != INVALID_SOCKET) shutdown(nlc->s, 2);
- if (nlc->s2 != INVALID_SOCKET) shutdown(nlc->s2, 2);
- nlc->termRequested = true;
+ NetlibConnection *nlc = (NetlibConnection*)wParam;
+ if (!nlc->termRequested) {
+ if (nlc->hSsl) si.shutdown(nlc->hSsl);
+ if (nlc->s != INVALID_SOCKET) shutdown(nlc->s, 2);
+ if (nlc->s2 != INVALID_SOCKET) shutdown(nlc->s2, 2);
+ nlc->termRequested = true;
+ }
}
break;
+
case NLH_BOUNDPORT:
- {
- struct NetlibBoundPort* nlb = (struct NetlibBoundPort*)wParam;
- if (nlb->s != INVALID_SOCKET) shutdown(nlb->s, 2);
- }
+ struct NetlibBoundPort* nlb = (struct NetlibBoundPort*)wParam;
+ if (nlb->s != INVALID_SOCKET)
+ shutdown(nlb->s, 2);
break;
}
ReleaseMutex(hConnectionHeaderMutex);
|