summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin10/lib/mir_app.libbin91646 -> 91876 bytes
-rw-r--r--bin10/lib/mir_app64.libbin87378 -> 87588 bytes
-rw-r--r--bin12/lib/mir_app.libbin91646 -> 91876 bytes
-rw-r--r--bin12/lib/mir_app64.libbin87378 -> 87588 bytes
-rw-r--r--bin14/lib/mir_app.libbin91646 -> 91876 bytes
-rw-r--r--bin14/lib/mir_app64.libbin87378 -> 87588 bytes
-rw-r--r--include/m_netlib.h5
-rw-r--r--src/mir_app/src/mir_app.def1
-rw-r--r--src/mir_app/src/mir_app64.def1
-rw-r--r--src/mir_app/src/netlib.cpp20
-rw-r--r--src/mir_app/src/netlib.h2
-rw-r--r--src/mir_app/src/netlibhttp.cpp4
-rw-r--r--src/mir_app/src/netlibhttpproxy.cpp2
-rw-r--r--src/mir_app/src/netlibopenconn.cpp4
14 files changed, 31 insertions, 8 deletions
diff --git a/bin10/lib/mir_app.lib b/bin10/lib/mir_app.lib
index 29880a94d1..34646c634b 100644
--- a/bin10/lib/mir_app.lib
+++ b/bin10/lib/mir_app.lib
Binary files differ
diff --git a/bin10/lib/mir_app64.lib b/bin10/lib/mir_app64.lib
index 89bfa8bed0..294adeb216 100644
--- a/bin10/lib/mir_app64.lib
+++ b/bin10/lib/mir_app64.lib
Binary files differ
diff --git a/bin12/lib/mir_app.lib b/bin12/lib/mir_app.lib
index 29880a94d1..34646c634b 100644
--- a/bin12/lib/mir_app.lib
+++ b/bin12/lib/mir_app.lib
Binary files differ
diff --git a/bin12/lib/mir_app64.lib b/bin12/lib/mir_app64.lib
index 89bfa8bed0..294adeb216 100644
--- a/bin12/lib/mir_app64.lib
+++ b/bin12/lib/mir_app64.lib
Binary files differ
diff --git a/bin14/lib/mir_app.lib b/bin14/lib/mir_app.lib
index 29880a94d1..34646c634b 100644
--- a/bin14/lib/mir_app.lib
+++ b/bin14/lib/mir_app.lib
Binary files differ
diff --git a/bin14/lib/mir_app64.lib b/bin14/lib/mir_app64.lib
index 89bfa8bed0..294adeb216 100644
--- a/bin14/lib/mir_app64.lib
+++ b/bin14/lib/mir_app64.lib
Binary files differ
diff --git a/include/m_netlib.h b/include/m_netlib.h
index 99a728ec0a..a5df2a3f91 100644
--- a/include/m_netlib.h
+++ b/include/m_netlib.h
@@ -382,6 +382,11 @@ struct NETLIBHTTPPROXYINFO
#define Netlib_GetBase64EncodedBufferSize(cbDecoded) (((cbDecoded)*4+11)/12*4+1)
/////////////////////////////////////////////////////////////////////////////////////////
+// Gets HNETLIBUSER owner of a connection
+
+EXTERN_C MIR_APP_DLL(HNETLIBUSER) Netlib_GetConnNlu(HANDLE hConn);
+
+/////////////////////////////////////////////////////////////////////////////////////////
// Converts string representation of IP and port into numerical SOCKADDR_INET
// IPv4 could supplied in formats address:port or address
// IPv6 could supplied in formats [address]:port or [address]
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 3c24d69dc5..98b5cf622c 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -353,3 +353,4 @@ Netlib_Log @353
Netlib_LogW @354
Netlib_Logf @355
Netlib_LogfW @356
+Netlib_GetConnNlu @357
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index b7a8c032e1..b777b03b2e 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -353,3 +353,4 @@ Netlib_Log @353
Netlib_LogW @354
Netlib_Logf @355
Netlib_LogfW @356
+Netlib_GetConnNlu @357
diff --git a/src/mir_app/src/netlib.cpp b/src/mir_app/src/netlib.cpp
index 71f1d5ea85..69b4195b37 100644
--- a/src/mir_app/src/netlib.cpp
+++ b/src/mir_app/src/netlib.cpp
@@ -230,7 +230,9 @@ static INT_PTR NetlibSetUserSettings(WPARAM wParam, LPARAM lParam)
return 1;
}
-void NetlibDoClose(NetlibConnection *nlc, bool noShutdown)
+/////////////////////////////////////////////////////////////////////////////////////////
+
+void NetlibDoCloseSocket(NetlibConnection *nlc, bool noShutdown)
{
if (nlc->s == INVALID_SOCKET) return;
@@ -278,7 +280,7 @@ MIR_APP_DLL(int) Netlib_CloseHandle(HANDLE hNetlib)
HttpGatewayRemovePacket(nlc, -1);
else {
if (nlc->s != INVALID_SOCKET)
- NetlibDoClose(nlc, nlc->termRequested);
+ NetlibDoCloseSocket(nlc, nlc->termRequested);
if (nlc->s2 != INVALID_SOCKET)
closesocket(nlc->s2);
nlc->s2 = INVALID_SOCKET;
@@ -318,6 +320,8 @@ MIR_APP_DLL(int) Netlib_CloseHandle(HANDLE hNetlib)
return 1;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
static INT_PTR NetlibGetSocket(WPARAM wParam, LPARAM)
{
SOCKET s;
@@ -344,6 +348,8 @@ static INT_PTR NetlibGetSocket(WPARAM wParam, LPARAM)
return s;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
INT_PTR NetlibStringToAddressSrv(WPARAM wParam, LPARAM lParam)
{
return (INT_PTR)!NetlibStringToAddress((char*)wParam, (SOCKADDR_INET_M*)lParam);
@@ -371,6 +377,16 @@ INT_PTR NetlibGetMyIp(WPARAM wParam, LPARAM)
return (INT_PTR)GetMyIp((unsigned)wParam);
}
+MIR_APP_DLL(HNETLIBUSER) Netlib_GetConnNlu(HANDLE hConn)
+{
+ if (GetNetlibHandleType(hConn) != NLH_CONNECTION)
+ return NULL;
+
+ return ((NetlibConnection*)hConn)->nlu;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
INT_PTR NetlibShutdown(WPARAM wParam, LPARAM)
{
if (wParam) {
diff --git a/src/mir_app/src/netlib.h b/src/mir_app/src/netlib.h
index 0e6281a935..738242b0ae 100644
--- a/src/mir_app/src/netlib.h
+++ b/src/mir_app/src/netlib.h
@@ -187,7 +187,7 @@ struct NetlibPacketRecver {
//netlib.c
void NetlibFreeUserSettingsStruct(NETLIBUSERSETTINGS *settings);
-void NetlibDoClose(NetlibConnection *nlc, bool noShutdown = false);
+void NetlibDoCloseSocket(NetlibConnection *nlc, bool noShutdown = false);
void NetlibInitializeNestedCS(NetlibNestedCriticalSection *nlncs);
void NetlibDeleteNestedCS(NetlibNestedCriticalSection *nlncs);
#define NLNCS_SEND 0
diff --git a/src/mir_app/src/netlibhttp.cpp b/src/mir_app/src/netlibhttp.cpp
index e04e8a21d0..b37a14e6dd 100644
--- a/src/mir_app/src/netlibhttp.cpp
+++ b/src/mir_app/src/netlibhttp.cpp
@@ -184,7 +184,7 @@ static NetlibConnection* NetlibHttpProcessUrl(NETLIBHTTPREQUEST *nlhr, NetlibUse
bool sameHost = mir_strcmp(nlc->nloc.szHost, nloc.szHost) == 0 && nlc->nloc.wPort == nloc.wPort;
if (!httpProxy && !sameHost) {
- NetlibDoClose(nlc);
+ NetlibDoCloseSocket(nlc);
mir_free((char*)nlc->nloc.szHost);
nlc->nloc = nloc;
@@ -1151,7 +1151,7 @@ next:
if (close &&
(nlc->proxyType != PROXYTYPE_HTTP || nlc->nloc.flags & NLOCF_SSL) &&
(!isConnect || nlhrReply->resultCode != 200))
- NetlibDoClose(nlc);
+ NetlibDoCloseSocket(nlc);
return nlhrReply;
}
diff --git a/src/mir_app/src/netlibhttpproxy.cpp b/src/mir_app/src/netlibhttpproxy.cpp
index 75c714a1c7..d34d67985e 100644
--- a/src/mir_app/src/netlibhttpproxy.cpp
+++ b/src/mir_app/src/netlibhttpproxy.cpp
@@ -113,7 +113,7 @@ static bool NetlibHttpGatewaySend(NetlibConnection *nlc, RequestType reqType, co
bool sameHost = mir_strcmp(nlc->nloc.szHost, nloc.szHost) == 0 && nlc->nloc.wPort == nloc.wPort;
if (!sameHost) {
- NetlibDoClose(nlc);
+ NetlibDoCloseSocket(nlc);
mir_free((char*)nlc->nloc.szHost);
nlc->nloc = nloc;
diff --git a/src/mir_app/src/netlibopenconn.cpp b/src/mir_app/src/netlibopenconn.cpp
index cbbf885d28..18216f1c51 100644
--- a/src/mir_app/src/netlibopenconn.cpp
+++ b/src/mir_app/src/netlibopenconn.cpp
@@ -660,7 +660,7 @@ static bool my_connect(NetlibConnection *nlc, NETLIBOPENCONNECTION *nloc)
static int NetlibHttpFallbackToDirect(NetlibConnection *nlc, NetlibUser *nlu, NETLIBOPENCONNECTION *nloc)
{
- NetlibDoClose(nlc, true);
+ NetlibDoCloseSocket(nlc, true);
Netlib_Logf(nlu, "Fallback to direct connection");
@@ -800,7 +800,7 @@ bool NetlibReconnect(NetlibConnection *nlc)
}
if (!opened)
- NetlibDoClose(nlc, true);
+ NetlibDoCloseSocket(nlc, true);
}
if (!opened) {