summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/modules/netlib/netlib.cpp22
-rw-r--r--src/modules/netlib/netlibhttp.cpp3
-rw-r--r--src/modules/netlib/netlibssl.cpp4
3 files changed, 15 insertions, 14 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);
diff --git a/src/modules/netlib/netlibhttp.cpp b/src/modules/netlib/netlibhttp.cpp
index a42e9ea700..36514df345 100644
--- a/src/modules/netlib/netlibhttp.cpp
+++ b/src/modules/netlib/netlibhttp.cpp
@@ -122,7 +122,8 @@ static int RecvWithTimeoutTime(NetlibConnection *nlc, unsigned dwTimeoutTime, ch
return NLRecv(nlc, buf, len, flags);
}
- if (nlc->termRequested || Miranda_Terminated()) return 0;
+ if (nlc->termRequested || Miranda_Terminated())
+ return 0;
}
SetLastError(ERROR_TIMEOUT);
return SOCKET_ERROR;
diff --git a/src/modules/netlib/netlibssl.cpp b/src/modules/netlib/netlibssl.cpp
index 3821c422a3..ccf0219e1f 100644
--- a/src/modules/netlib/netlibssl.cpp
+++ b/src/modules/netlib/netlibssl.cpp
@@ -357,9 +357,7 @@ static SECURITY_STATUS ClientHandshakeLoop(SslHandle *ssl, BOOL fDoInitialRead)
if (scRet == SEC_E_OK) {
// Store remaining data for further use
if (InBuffers[1].BufferType == SECBUFFER_EXTRA) {
- memmove(ssl->pbIoBuffer,
- ssl->pbIoBuffer + (ssl->cbIoBuffer - InBuffers[1].cbBuffer),
- InBuffers[1].cbBuffer);
+ memmove(ssl->pbIoBuffer, ssl->pbIoBuffer + (ssl->cbIoBuffer - InBuffers[1].cbBuffer), InBuffers[1].cbBuffer);
ssl->cbIoBuffer = InBuffers[1].cbBuffer;
}
else ssl->cbIoBuffer = 0;