summaryrefslogtreecommitdiff
path: root/src/modules/netlib
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-08-12 22:17:40 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-08-12 22:17:40 +0000
commit858fb2dfc3f198d5c0c861528115411d4d6904d6 (patch)
tree7e304e42c9339e54a7a4abfb4a1ae638a24f8959 /src/modules/netlib
parent9f06e7ffdd6458dd25bfd5b915cb788bab03bea0 (diff)
netlib moved to the core logger
git-svn-id: http://svn.miranda-ng.org/main/trunk@5665 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/netlib')
-rw-r--r--src/modules/netlib/netlib.cpp20
-rw-r--r--src/modules/netlib/netlib.h36
-rw-r--r--src/modules/netlib/netlibbind.cpp4
-rw-r--r--src/modules/netlib/netlibhttp.cpp8
-rw-r--r--src/modules/netlib/netlibhttpproxy.cpp14
-rw-r--r--src/modules/netlib/netliblog.cpp39
-rw-r--r--src/modules/netlib/netlibopenconn.cpp12
-rw-r--r--src/modules/netlib/netlibpktrecver.cpp2
8 files changed, 58 insertions, 77 deletions
diff --git a/src/modules/netlib/netlib.cpp b/src/modules/netlib/netlib.cpp
index 701c61cb19..e56cf59811 100644
--- a/src/modules/netlib/netlib.cpp
+++ b/src/modules/netlib/netlib.cpp
@@ -52,21 +52,21 @@ void NetlibFreeUserSettingsStruct(NETLIBUSERSETTINGS *settings)
mir_free(settings->szProxyServer);
}
-void NetlibInitializeNestedCS(struct NetlibNestedCriticalSection *nlncs)
+void NetlibInitializeNestedCS(NetlibNestedCriticalSection *nlncs)
{
nlncs->dwOwningThreadId = 0;
nlncs->lockCount = 0;
nlncs->hMutex = CreateMutex(NULL, FALSE, NULL);
}
-void NetlibDeleteNestedCS(struct NetlibNestedCriticalSection *nlncs)
+void NetlibDeleteNestedCS(NetlibNestedCriticalSection *nlncs)
{
CloseHandle(nlncs->hMutex);
}
-int NetlibEnterNestedCS(struct NetlibConnection *nlc, int which)
+int NetlibEnterNestedCS(NetlibConnection *nlc, int which)
{
- struct NetlibNestedCriticalSection *nlncs;
+ NetlibNestedCriticalSection *nlncs;
DWORD dwCurrentThreadId = GetCurrentThreadId();
WaitForSingleObject(hConnectionHeaderMutex, INFINITE);
@@ -92,7 +92,7 @@ int NetlibEnterNestedCS(struct NetlibConnection *nlc, int which)
return 1;
}
-void NetlibLeaveNestedCS(struct NetlibNestedCriticalSection *nlncs)
+void NetlibLeaveNestedCS(NetlibNestedCriticalSection *nlncs)
{
if (--nlncs->lockCount == 0) {
nlncs->dwOwningThreadId = 0;
@@ -138,7 +138,7 @@ static INT_PTR NetlibRegisterUser(WPARAM, LPARAM lParam)
return 0;
}
- NetlibUser *thisUser = (struct NetlibUser*)mir_calloc(sizeof(struct NetlibUser));
+ NetlibUser *thisUser = (NetlibUser*)mir_calloc(sizeof(NetlibUser));
thisUser->handleType = NLH_USER;
thisUser->user = *nlu;
@@ -201,7 +201,7 @@ static INT_PTR NetlibRegisterUser(WPARAM, LPARAM lParam)
static INT_PTR NetlibGetUserSettings(WPARAM wParam, LPARAM lParam)
{
NETLIBUSERSETTINGS *nlus = (NETLIBUSERSETTINGS*)lParam;
- struct NetlibUser *nlu = (struct NetlibUser*)wParam;
+ NetlibUser *nlu = (NetlibUser*)wParam;
if (GetNetlibHandleType(nlu) != NLH_USER || nlus == NULL || nlus->cbSize != sizeof(NETLIBUSERSETTINGS)) {
SetLastError(ERROR_INVALID_PARAMETER);
@@ -214,7 +214,7 @@ static INT_PTR NetlibGetUserSettings(WPARAM wParam, LPARAM lParam)
static INT_PTR NetlibSetUserSettings(WPARAM wParam, LPARAM lParam)
{
NETLIBUSERSETTINGS *nlus = (NETLIBUSERSETTINGS*)lParam;
- struct NetlibUser *nlu = (struct NetlibUser*)wParam;
+ NetlibUser *nlu = (NetlibUser*)wParam;
if (GetNetlibHandleType(nlu) != NLH_USER || nlus == NULL || nlus->cbSize != sizeof(NETLIBUSERSETTINGS)) {
SetLastError(ERROR_INVALID_PARAMETER);
@@ -245,7 +245,7 @@ INT_PTR NetlibCloseHandle(WPARAM wParam, LPARAM)
{
case NLH_USER:
{
- struct NetlibUser *nlu = (struct NetlibUser*)wParam;
+ NetlibUser *nlu = (NetlibUser*)wParam;
{
mir_cslock lck(csNetlibUser);
int i = netlibUser.getIndex(nlu);
@@ -263,7 +263,7 @@ INT_PTR NetlibCloseHandle(WPARAM wParam, LPARAM)
}
case NLH_CONNECTION:
{
- struct NetlibConnection *nlc = (struct NetlibConnection*)wParam;
+ NetlibConnection *nlc = (struct NetlibConnection*)wParam;
HANDLE waitHandles[4];
DWORD waitResult;
diff --git a/src/modules/netlib/netlib.h b/src/modules/netlib/netlib.h
index c7ca929e0c..290d9b44b6 100644
--- a/src/modules/netlib/netlib.h
+++ b/src/modules/netlib/netlib.h
@@ -48,7 +48,7 @@ struct NetlibNestedCriticalSection
struct NetlibHTTPProxyPacketQueue
{
- struct NetlibHTTPProxyPacketQueue *next;
+ NetlibHTTPProxyPacketQueue *next;
PBYTE dataBuffer;
int dataBufferLen;
};
@@ -68,16 +68,16 @@ struct NetlibConnection
bool proxyAuthNeeded;
bool dnsThroughProxy;
bool termRequested;
- struct NetlibUser *nlu;
+ NetlibUser *nlu;
NETLIBHTTPPROXYINFO nlhpi;
PBYTE dataBuffer;
int dataBufferLen;
CRITICAL_SECTION csHttpSequenceNums;
HANDLE hOkToCloseEvent;
LONG dontCloseNow;
- struct NetlibNestedCriticalSection ncsSend, ncsRecv;
+ NetlibNestedCriticalSection ncsSend, ncsRecv;
HSSL hSsl;
- struct NetlibHTTPProxyPacketQueue * pHttpProxyPacketQueue;
+ NetlibHTTPProxyPacketQueue * pHttpProxyPacketQueue;
char *szNewUrl;
char *szProxyServer;
WORD wProxyPort;
@@ -93,7 +93,7 @@ struct NetlibBoundPort {
SOCKET s6;
WORD wPort;
WORD wExPort;
- struct NetlibUser *nlu;
+ NetlibUser *nlu;
NETLIBNEWCONNECTIONPROC_V2 pfnNewConnectionV2;
HANDLE hThread;
void *pExtra;
@@ -101,7 +101,7 @@ struct NetlibBoundPort {
struct NetlibPacketRecver {
int handleType;
- struct NetlibConnection *nlc;
+ NetlibConnection *nlc;
NETLIBPACKETRECVER packetRecver;
};
@@ -109,12 +109,12 @@ struct NetlibPacketRecver {
void NetlibFreeUserSettingsStruct(NETLIBUSERSETTINGS *settings);
void NetlibDoClose(NetlibConnection *nlc, bool noShutdown = false);
INT_PTR NetlibCloseHandle(WPARAM wParam, LPARAM lParam);
-void NetlibInitializeNestedCS(struct NetlibNestedCriticalSection *nlncs);
-void NetlibDeleteNestedCS(struct NetlibNestedCriticalSection *nlncs);
+void NetlibInitializeNestedCS(NetlibNestedCriticalSection *nlncs);
+void NetlibDeleteNestedCS(NetlibNestedCriticalSection *nlncs);
#define NLNCS_SEND 0
#define NLNCS_RECV 1
-int NetlibEnterNestedCS(struct NetlibConnection *nlc, int which);
-void NetlibLeaveNestedCS(struct NetlibNestedCriticalSection *nlncs);
+int NetlibEnterNestedCS(NetlibConnection *nlc, int which);
+void NetlibLeaveNestedCS(NetlibNestedCriticalSection *nlncs);
INT_PTR NetlibBase64Encode(WPARAM wParam, LPARAM lParam);
INT_PTR NetlibBase64Decode(WPARAM wParam, LPARAM lParam);
INT_PTR NetlibHttpUrlEncode(WPARAM wParam, LPARAM lParam);
@@ -129,7 +129,7 @@ char* NetlibGetIeProxy(char *szUrl);
bool NetlibGetIeProxyConn(NetlibConnection *nlc, bool forceHttps);
//netlibbind.c
-int NetlibFreeBoundPort(struct NetlibBoundPort *nlbp);
+int NetlibFreeBoundPort(NetlibBoundPort *nlbp);
INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam);
bool BindSocketToPort(const char *szPorts, SOCKET s, SOCKET s6, int* portn);
@@ -143,9 +143,9 @@ NETLIBHTTPREQUEST* NetlibHttpRecv(NetlibConnection* nlc, DWORD hflags, DWORD dfl
void NetlibConnFromUrl(const char* szUrl, bool secur, NETLIBOPENCONNECTION &nloc);
//netlibhttpproxy.c
-int NetlibInitHttpConnection(struct NetlibConnection *nlc, struct NetlibUser *nlu, NETLIBOPENCONNECTION *nloc);
-int NetlibHttpGatewayRecv(struct NetlibConnection *nlc, char *buf, int len, int flags);
-int NetlibHttpGatewayPost(struct NetlibConnection *nlc, const char *buf, int len, int flags);
+int NetlibInitHttpConnection(NetlibConnection *nlc, NetlibUser *nlu, NETLIBOPENCONNECTION *nloc);
+int NetlibHttpGatewayRecv(NetlibConnection *nlc, char *buf, int len, int flags);
+int NetlibHttpGatewayPost(NetlibConnection *nlc, const char *buf, int len, int flags);
void HttpGatewayRemovePacket(NetlibConnection *nlc, int pck);
INT_PTR NetlibHttpGatewaySetInfo(WPARAM wParam, LPARAM lParam);
@@ -154,13 +154,13 @@ INT_PTR NetlibHttpSetSticky(WPARAM wParam, LPARAM lParam);
//netliblog.c
void NetlibLogShowOptions(void);
-void NetlibDumpData(struct NetlibConnection *nlc, PBYTE buf, int len, int sent, int flags);
+void NetlibDumpData(NetlibConnection *nlc, PBYTE buf, int len, int sent, int flags);
void NetlibLogf(NetlibUser* nlu, const char *fmt, ...);
void NetlibLogInit(void);
void NetlibLogShutdown(void);
//netlibopenconn.c
-DWORD DnsLookup(struct NetlibUser *nlu, const char *szHost);
+DWORD DnsLookup(NetlibUser *nlu, const char *szHost);
int WaitUntilReadable(SOCKET s, DWORD dwTimeout, bool check = false);
int WaitUntilWritable(SOCKET s, DWORD dwTimeout);
bool NetlibDoConnect(NetlibConnection *nlc);
@@ -209,12 +209,12 @@ HANDLE NetlibInitSecurityProvider(const char* szProvider, const char* szPrincipa
char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, const TCHAR* login, const TCHAR* psw,
bool http, unsigned& complete);
-static __inline INT_PTR NLSend(struct NetlibConnection *nlc, const char *buf, int len, int flags) {
+static __inline INT_PTR NLSend(NetlibConnection *nlc, const char *buf, int len, int flags) {
NETLIBBUFFER nlb = {(char*)buf, len, flags};
return NetlibSend((WPARAM)nlc, (LPARAM)&nlb);
}
-static __inline INT_PTR NLRecv(struct NetlibConnection *nlc, char *buf, int len, int flags) {
+static __inline INT_PTR NLRecv(NetlibConnection *nlc, char *buf, int len, int flags) {
NETLIBBUFFER nlb = {buf, len, flags};
return NetlibRecv((WPARAM)nlc, (LPARAM)&nlb);
}
diff --git a/src/modules/netlib/netlibbind.cpp b/src/modules/netlib/netlibbind.cpp
index 24aca3c492..10ac9b3725 100644
--- a/src/modules/netlib/netlibbind.cpp
+++ b/src/modules/netlib/netlibbind.cpp
@@ -123,7 +123,7 @@ static void NetlibBindAcceptThread(void* param)
SOCKET s;
SOCKADDR_INET_M sin;
int sinLen;
- struct NetlibConnection *nlc;
+ NetlibConnection *nlc;
struct NetlibBoundPort *nlbp = (NetlibBoundPort*)param;
NetlibLogf(nlbp->nlu, "(%u) Port %u opened for incoming connections", nlbp->s, nlbp->wPort);
@@ -173,7 +173,7 @@ static void NetlibBindAcceptThread(void* param)
INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam)
{
NETLIBBIND *nlb = (NETLIBBIND*)lParam;
- struct NetlibUser *nlu = (struct NetlibUser*)wParam;
+ NetlibUser *nlu = (NetlibUser*)wParam;
struct NetlibBoundPort *nlbp;
SOCKADDR_IN sin = {0};
SOCKADDR_IN6 sin6 = {0};
diff --git a/src/modules/netlib/netlibhttp.cpp b/src/modules/netlib/netlibhttp.cpp
index 5830198596..9aafc3d066 100644
--- a/src/modules/netlib/netlibhttp.cpp
+++ b/src/modules/netlib/netlibhttp.cpp
@@ -104,7 +104,7 @@ static void AppendToCharBuffer(struct ResizableCharBuffer *rcb, const char *fmt,
rcb->iEnd += charsDone;
}
-static int RecvWithTimeoutTime(struct NetlibConnection *nlc, unsigned dwTimeoutTime, char *buf, int len, int flags)
+static int RecvWithTimeoutTime(NetlibConnection *nlc, unsigned dwTimeoutTime, char *buf, int len, int flags)
{
DWORD dwTimeNow;
@@ -363,7 +363,7 @@ static int HttpPeekFirstResponseLine(NetlibConnection *nlc, DWORD dwTimeoutTime,
return 1;
}
-static int SendHttpRequestAndData(struct NetlibConnection *nlc, struct ResizableCharBuffer *httpRequest, NETLIBHTTPREQUEST *nlhr, int sendContentLengthHeader)
+static int SendHttpRequestAndData(NetlibConnection *nlc, struct ResizableCharBuffer *httpRequest, NETLIBHTTPREQUEST *nlhr, int sendContentLengthHeader)
{
bool sendData = (nlhr->requestType == REQUEST_POST || nlhr->requestType == REQUEST_PUT);
@@ -396,7 +396,7 @@ static int SendHttpRequestAndData(struct NetlibConnection *nlc, struct Resizable
INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam)
{
- struct NetlibConnection *nlc = (struct NetlibConnection*)wParam;
+ NetlibConnection *nlc = (struct NetlibConnection*)wParam;
NETLIBHTTPREQUEST *nlhr = (NETLIBHTTPREQUEST*)lParam;
NETLIBHTTPREQUEST *nlhrReply = NULL;
HttpSecurityContext httpSecurity;
@@ -725,7 +725,7 @@ INT_PTR NetlibHttpFreeRequestStruct(WPARAM, LPARAM lParam)
INT_PTR NetlibHttpRecvHeaders(WPARAM wParam, LPARAM lParam)
{
- struct NetlibConnection *nlc = (struct NetlibConnection*)wParam;
+ NetlibConnection *nlc = (struct NetlibConnection*)wParam;
if ( !NetlibEnterNestedCS(nlc, NLNCS_RECV))
return 0;
diff --git a/src/modules/netlib/netlibhttpproxy.cpp b/src/modules/netlib/netlibhttpproxy.cpp
index efdb0a5ab4..efcaca9e3b 100644
--- a/src/modules/netlib/netlibhttpproxy.cpp
+++ b/src/modules/netlib/netlibhttpproxy.cpp
@@ -62,7 +62,7 @@ void HttpGatewayRemovePacket(NetlibConnection *nlc, int pck)
}
}
-static bool NetlibHttpGatewaySend(struct NetlibConnection *nlc, RequestType reqType, const char *buf, int len)
+static bool NetlibHttpGatewaySend(NetlibConnection *nlc, RequestType reqType, const char *buf, int len)
{
NETLIBHTTPREQUEST nlhrSend = {0};
char szUrl[512];
@@ -222,7 +222,7 @@ static bool NetlibHttpGatewayOscarPost(NetlibConnection *nlc, const char *buf, i
return res;
}
- int NetlibHttpGatewayPost(struct NetlibConnection *nlc, const char *buf, int len, int flags)
+ int NetlibHttpGatewayPost(NetlibConnection *nlc, const char *buf, int len, int flags)
{
if (nlc->nlhpi.szHttpGetUrl != NULL)
return NetlibHttpGatewayOscarPost(nlc, buf, len, flags) ? len : SOCKET_ERROR;
@@ -267,7 +267,7 @@ static bool NetlibHttpGatewayOscarPost(NetlibConnection *nlc, const char *buf, i
#define NETLIBHTTP_RETRYCOUNT 3
#define NETLIBHTTP_RETRYTIMEOUT 2000
-int NetlibHttpGatewayRecv(struct NetlibConnection *nlc, char *buf, int len, int flags)
+int NetlibHttpGatewayRecv(NetlibConnection *nlc, char *buf, int len, int flags)
{
bool peek = (flags & MSG_PEEK) != 0;
@@ -399,7 +399,7 @@ int NetlibHttpGatewayRecv(struct NetlibConnection *nlc, char *buf, int len, int
return SOCKET_ERROR;
}
-int NetlibInitHttpConnection(struct NetlibConnection *nlc, struct NetlibUser *nlu, NETLIBOPENCONNECTION *nloc)
+int NetlibInitHttpConnection(NetlibConnection *nlc, NetlibUser *nlu, NETLIBOPENCONNECTION *nloc)
{
NETLIBHTTPREQUEST *nlhrReply = NULL;
@@ -449,7 +449,7 @@ int NetlibInitHttpConnection(struct NetlibConnection *nlc, struct NetlibUser *nl
INT_PTR NetlibHttpGatewaySetInfo(WPARAM wParam, LPARAM lParam)
{
NETLIBHTTPPROXYINFO *nlhpi = (NETLIBHTTPPROXYINFO*)lParam;
- struct NetlibConnection *nlc = (struct NetlibConnection*)wParam;
+ NetlibConnection *nlc = (struct NetlibConnection*)wParam;
if (GetNetlibHandleType(nlc) != NLH_CONNECTION || nlhpi == NULL ||
nlhpi->cbSize < (sizeof(NETLIBHTTPPROXYINFO) - sizeof(int)) ||
@@ -474,7 +474,7 @@ INT_PTR NetlibHttpGatewaySetInfo(WPARAM wParam, LPARAM lParam)
INT_PTR NetlibHttpSetSticky(WPARAM wParam, LPARAM lParam)
{
- struct NetlibUser * nu = (struct NetlibUser*)wParam;
+ NetlibUser * nu = (NetlibUser*)wParam;
if (GetNetlibHandleType(nu) != NLH_USER) return ERROR_INVALID_PARAMETER;
mir_free(nu->szStickyHeaders);
nu->szStickyHeaders = mir_strdup((char*)lParam); // pointer is ours
@@ -484,7 +484,7 @@ INT_PTR NetlibHttpSetSticky(WPARAM wParam, LPARAM lParam)
INT_PTR NetlibHttpSetPollingTimeout(WPARAM wParam, LPARAM lParam)
{
int oldTimeout;
- struct NetlibConnection *nlc = (struct NetlibConnection*)wParam;
+ NetlibConnection *nlc = (struct NetlibConnection*)wParam;
if (GetNetlibHandleType(nlc) != NLH_CONNECTION) return -1;
oldTimeout = nlc->pollingTimeout;
nlc->pollingTimeout = lParam;
diff --git a/src/modules/netlib/netliblog.cpp b/src/modules/netlib/netliblog.cpp
index b8567a494f..4f0aecff29 100644
--- a/src/modules/netlib/netliblog.cpp
+++ b/src/modules/netlib/netliblog.cpp
@@ -37,13 +37,12 @@ struct {
int toOutputDebugString;
int toFile;
int toLog;
- TCHAR* szFile;
- TCHAR* szUserFile;
+ TCHAR *szFile;
+ TCHAR *szUserFile;
int timeFormat;
int showUser;
int dumpSent, dumpRecv, dumpProxy, dumpSsl;
int textDumps, autoDetectText;
- CRITICAL_SECTION cs;
int save;
} logOptions = {0};
@@ -55,6 +54,7 @@ typedef struct {
static __int64 mirandaStartTime, perfCounterFreq;
static int bIsActive = TRUE;
static HANDLE hLogEvent = NULL;
+static HANDLE hLogger = NULL;
static const TCHAR* szTimeFormats[] =
{
@@ -210,8 +210,6 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
db_set_ts(NULL, "Netlib", "RunAtStart", str);
db_set_b(NULL, "Netlib", "ShowLogOptsAtStart", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWTHISDLGATSTART));
- mir_cslock lck(logOptions.cs);
-
mir_free(logOptions.szUserFile);
GetWindowText( GetDlgItem(hwndDlg, IDC_FILENAME), str, MAX_PATH);
logOptions.szUserFile = mir_tstrdup(str);
@@ -309,8 +307,8 @@ static INT_PTR ShowOptions(WPARAM, LPARAM)
static INT_PTR NetlibLog(WPARAM wParam, LPARAM lParam)
{
- struct NetlibUser *nlu = (struct NetlibUser*)wParam;
- struct NetlibUser nludummy;
+ NetlibUser *nlu = (NetlibUser*)wParam;
+ NetlibUser nludummy;
const char *pszMsg = (const char*)lParam;
char szTime[32], szHead[128];
LARGE_INTEGER liTimeNow;
@@ -374,18 +372,8 @@ static INT_PTR NetlibLog(WPARAM wParam, LPARAM lParam)
}
if (logOptions.toFile && logOptions.szFile[0]) {
- mir_cslock lck(logOptions.cs);
-
- FILE *fp = _tfopen(logOptions.szFile, _T("ab"));
- if ( !fp) {
- CreatePathToFileT(logOptions.szFile);
- fp = _tfopen(logOptions.szFile, _T("at"));
- }
- if (fp) {
- size_t len = strlen(pszMsg);
- fprintf(fp, "%s%s%s", szHead, pszMsg, pszMsg[len-1] == '\n' ? "" : "\r\n");
- fclose(fp);
- }
+ size_t len = strlen(pszMsg);
+ mir_writeLogA(hLogger, "%s%s%s", szHead, pszMsg, pszMsg[len-1] == '\n' ? "" : "\r\n");
}
LOGMSG logMsg = { szHead, pszMsg };
@@ -424,13 +412,13 @@ void NetlibLogf(NetlibUser* nlu, const char *fmt, ...)
NetlibLog((WPARAM)nlu, (LPARAM)szText);
}
-void NetlibDumpData(struct NetlibConnection *nlc, PBYTE buf, int len, int sent, int flags)
+void NetlibDumpData(NetlibConnection *nlc, PBYTE buf, int len, int sent, int flags)
{
int isText = 1;
char szTitleLine[128];
char *szBuf;
int titleLineLen;
- struct NetlibUser *nlu;
+ NetlibUser *nlu;
bool useStack = false;
// This section checks a number of conditions and aborts
@@ -550,7 +538,6 @@ void NetlibLogInit(void)
CreateServiceFunction(MS_NETLIB_LOGW, NetlibLogW);
hLogEvent = CreateHookableEvent(ME_NETLIB_FASTDUMP);
- InitializeCriticalSection(&logOptions.cs);
logOptions.dumpRecv = db_get_b(NULL, "Netlib", "DumpRecv", 1);
logOptions.dumpSent = db_get_b(NULL, "Netlib", "DumpSent", 1);
logOptions.dumpProxy = db_get_b(NULL, "Netlib", "DumpProxy", 1);
@@ -577,12 +564,7 @@ void NetlibLogInit(void)
logOptions.szFile = Utils_ReplaceVarsT(logOptions.szUserFile);
}
- if (logOptions.toFile && logOptions.szFile[0]) {
- FILE *fp;
- fp = _tfopen(logOptions.szFile, _T("wt"));
- if (fp)
- fclose(fp);
- }
+ hLogger = mir_createLog("Netlib", LPGENT("Standard netlib log"), logOptions.szFile, 0);
if (db_get_b(NULL, "Netlib", "ShowLogOptsAtStart", 0))
NetlibLogShowOptions();
@@ -603,7 +585,6 @@ void NetlibLogShutdown(void)
DestroyHookableEvent(hLogEvent); hLogEvent = NULL;
if (IsWindow(logOptions.hwndOpts))
DestroyWindow(logOptions.hwndOpts);
- DeleteCriticalSection(&logOptions.cs);
mir_free(logOptions.szFile);
mir_free(logOptions.szUserFile);
}
diff --git a/src/modules/netlib/netlibopenconn.cpp b/src/modules/netlib/netlibopenconn.cpp
index 4b4a5ea4d8..57c83ed507 100644
--- a/src/modules/netlib/netlibopenconn.cpp
+++ b/src/modules/netlib/netlibopenconn.cpp
@@ -33,7 +33,7 @@ static int iUPnPCleanup = 0;
#define RECV_DEFAULT_TIMEOUT 60000
//returns in network byte order
-DWORD DnsLookup(struct NetlibUser *nlu, const char *szHost)
+DWORD DnsLookup(NetlibUser *nlu, const char *szHost)
{
HOSTENT* host;
DWORD ip = inet_addr(szHost);
@@ -91,7 +91,7 @@ int WaitUntilWritable(SOCKET s, DWORD dwTimeout)
return 1;
}
-bool RecvUntilTimeout(struct NetlibConnection *nlc, char *buf, int len, int flags, DWORD dwTimeout)
+bool RecvUntilTimeout(NetlibConnection *nlc, char *buf, int len, int flags, DWORD dwTimeout)
{
int nReceived = 0;
DWORD dwTimeNow, dwCompleteTime = GetTickCount() + dwTimeout;
@@ -156,7 +156,7 @@ static int NetlibInitSocks4Connection(NetlibConnection *nlc, NetlibUser *nlu, NE
return 0;
}
-static int NetlibInitSocks5Connection(struct NetlibConnection *nlc, struct NetlibUser *nlu, NETLIBOPENCONNECTION *nloc)
+static int NetlibInitSocks5Connection(NetlibConnection *nlc, NetlibUser *nlu, NETLIBOPENCONNECTION *nloc)
{
//rfc1928
BYTE buf[258];
@@ -297,7 +297,7 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc, struct Netli
return 1;
}
-static bool NetlibInitHttpsConnection(struct NetlibConnection *nlc, struct NetlibUser *nlu, NETLIBOPENCONNECTION *nloc)
+static bool NetlibInitHttpsConnection(NetlibConnection *nlc, NetlibUser *nlu, NETLIBOPENCONNECTION *nloc)
{
//rfc2817
NETLIBHTTPREQUEST nlhrSend = {0}, *nlhrReply;
@@ -344,7 +344,7 @@ static bool NetlibInitHttpsConnection(struct NetlibConnection *nlc, struct Netli
return true;
}
-static void FreePartiallyInitedConnection(struct NetlibConnection *nlc)
+static void FreePartiallyInitedConnection(NetlibConnection *nlc)
{
DWORD dwOriginalLastError = GetLastError();
@@ -672,7 +672,7 @@ static bool my_connect(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc)
return MyGetaddrinfo && MyFreeaddrinfo ? my_connectIPv6(nlc, nloc) : my_connectIPv4(nlc, nloc);
}
-static int NetlibHttpFallbackToDirect(struct NetlibConnection *nlc, struct NetlibUser *nlu, NETLIBOPENCONNECTION *nloc)
+static int NetlibHttpFallbackToDirect(NetlibConnection *nlc, NetlibUser *nlu, NETLIBOPENCONNECTION *nloc)
{
NetlibDoClose(nlc, true);
diff --git a/src/modules/netlib/netlibpktrecver.cpp b/src/modules/netlib/netlibpktrecver.cpp
index 45e39344c5..aa41bf6c8a 100644
--- a/src/modules/netlib/netlibpktrecver.cpp
+++ b/src/modules/netlib/netlibpktrecver.cpp
@@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
INT_PTR NetlibPacketRecverCreate(WPARAM wParam, LPARAM lParam)
{
- struct NetlibConnection *nlc = (struct NetlibConnection*)wParam;
+ NetlibConnection *nlc = (struct NetlibConnection*)wParam;
struct NetlibPacketRecver *nlpr;
if (GetNetlibHandleType(nlc) != NLH_CONNECTION || lParam == 0) {