summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-11 15:11:36 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-11 15:11:36 +0000
commit6aeafa47b02b966067d3ff83453c9ae8f9b0fc70 (patch)
tree30a31a165c2712d6af297cf4819fc5787f5344d7 /src
parent1ba746b6a4c979841a3b3452347da0aa78964f95 (diff)
only a few real mir_forkthreadex survived
git-svn-id: http://svn.miranda-ng.org/main/trunk@3977 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/modules/netlib/netlibautoproxy.cpp26
-rw-r--r--src/modules/netlib/netlibbind.cpp10
2 files changed, 11 insertions, 25 deletions
diff --git a/src/modules/netlib/netlibautoproxy.cpp b/src/modules/netlib/netlibautoproxy.cpp
index 3d46a739f8..204f23ae29 100644
--- a/src/modules/netlib/netlibautoproxy.cpp
+++ b/src/modules/netlib/netlibautoproxy.cpp
@@ -266,13 +266,12 @@ struct IeProxyParam
char *szProxy;
};
-static unsigned __stdcall NetlibIeProxyThread(void * arg)
+static void NetlibIeProxyThread(void *arg)
{
IeProxyParam *param = (IeProxyParam*)arg;
param->szProxy = NULL;
- if ( !bAutoProxyInit)
- {
+ if ( !bAutoProxyInit) {
WaitForSingleObject(hIeProxyMutex, INFINITE);
NetlibInitAutoProxy();
ReleaseMutex(hIeProxyMutex);
@@ -280,14 +279,12 @@ static unsigned __stdcall NetlibIeProxyThread(void * arg)
BOOL res;
char *loc = strstr(szAutoUrlStr, "file://");
- if (loc || strstr(szAutoUrlStr, "://") == NULL)
- {
+ if (loc || strstr(szAutoUrlStr, "://") == NULL) {
NetlibLogf(NULL, "Autoproxy Init file: %s", loc);
loc = loc ? loc + 7 : szAutoUrlStr;
res = pInternetInitializeAutoProxyDll(0, loc, NULL, NULL /*&HelperFunctions*/, NULL);
}
- else
- {
+ else {
NetlibLogf(NULL, "Autoproxy Init %d", abuf.dwScriptBufferSize);
if (abuf.dwScriptBufferSize)
res = pInternetInitializeAutoProxyDll(0, NULL, NULL, NULL /*&HelperFunctions*/, &abuf);
@@ -295,8 +292,7 @@ static unsigned __stdcall NetlibIeProxyThread(void * arg)
res = false;
}
- if (res)
- {
+ if (res) {
char proxyBuffer[1024];
char *proxy = proxyBuffer;
DWORD dwProxyLen = sizeof(proxyBuffer);
@@ -308,10 +304,7 @@ static unsigned __stdcall NetlibIeProxyThread(void * arg)
NetlibLogf(NULL, "Autoproxy got response %s, Param: %s %s", param->szProxy, param->szUrl, param->szHost);
pInternetDeInitializeAutoProxyDll(NULL, 0);
}
- else
- NetlibLogf(NULL, "Autoproxy init failed");
-
- return 0;
+ else NetlibLogf(NULL, "Autoproxy init failed");
}
char* NetlibGetIeProxy(char *szUrl)
@@ -352,13 +345,10 @@ char* NetlibGetIeProxy(char *szUrl)
return res;
}
- if (szAutoUrlStr[0])
- {
- unsigned dwThreadId;
+ if (szAutoUrlStr[0]) {
IeProxyParam param = { szUrl, szHost, NULL };
- HANDLE hThread = (HANDLE)mir_forkthreadex(NetlibIeProxyThread, &param, &dwThreadId);
+ HANDLE hThread = mir_forkthread(NetlibIeProxyThread, &param);
WaitForSingleObject(hThread, INFINITE);
- CloseHandle(hThread);
res = param.szProxy;
}
return res;
diff --git a/src/modules/netlib/netlibbind.cpp b/src/modules/netlib/netlibbind.cpp
index 01ed2b7413..9e1752cd33 100644
--- a/src/modules/netlib/netlibbind.cpp
+++ b/src/modules/netlib/netlibbind.cpp
@@ -113,13 +113,12 @@ int NetlibFreeBoundPort(struct NetlibBoundPort *nlbp)
closesocket(nlbp->s);
closesocket(nlbp->s6);
WaitForSingleObject(nlbp->hThread, INFINITE);
- CloseHandle(nlbp->hThread);
NetlibLogf(nlbp->nlu, "(%u) Port %u closed for incoming connections", nlbp->s, nlbp->wPort);
mir_free(nlbp);
return 1;
}
-static unsigned __stdcall NetlibBindAcceptThread(void* param)
+static void NetlibBindAcceptThread(void* param)
{
SOCKET s;
SOCKADDR_INET_M sin;
@@ -169,7 +168,6 @@ static unsigned __stdcall NetlibBindAcceptThread(void* param)
nlbp->pfnNewConnectionV2(nlc, ntohl(sin.Ipv4.sin_addr.S_un.S_addr), nlbp->pExtra);
}
NetlibUPnPDeletePortMapping(nlbp->wExPort, "TCP");
- return 0;
}
INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam)
@@ -180,7 +178,6 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam)
SOCKADDR_IN sin = {0};
SOCKADDR_IN6 sin6 = {0};
int foundPort = 0;
- UINT dwThreadId;
if (GetNetlibHandleType(nlu) != NLH_USER || !(nlu->user.flags & NUF_INCOMING) ||
nlb == NULL || nlb->pfnNewConnection == NULL)
@@ -319,14 +316,13 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam)
NetlibLogf(NULL, "UPnP disabled. Internal Port: %u\n", nlb->wPort);
nlbp->wExPort = 0;
- if (nlb->cbSize > NETLIBBIND_SIZEOF_V2)
- {
+ if (nlb->cbSize > NETLIBBIND_SIZEOF_V2) {
nlb->wExPort = nlb->wPort;
nlb->dwExternalIP = nlb->dwInternalIP;
}
}
}
- nlbp->hThread = (HANDLE)mir_forkthreadex(NetlibBindAcceptThread, nlbp, &dwThreadId);
+ nlbp->hThread = mir_forkthread(NetlibBindAcceptThread, nlbp);
return (INT_PTR)nlbp;
}