fixes bug 201570 "enable socket transport logging in nightly builds" r=dougt sr=brendan

git-svn-id: svn://10.0.0.236/trunk@141018 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
darin%netscape.com 2003-04-11 01:19:07 +00:00
parent 0bf265c0cd
commit 6d3b44ee11
4 changed files with 27 additions and 13 deletions

View File

@ -35,6 +35,10 @@
*
* ***** END LICENSE BLOCK ***** */
#ifdef MOZ_LOGGING
#define FORCE_PR_LOG
#endif
#include "nsSocketTransport2.h"
#include "nsIOService.h"
#include "nsStreamUtils.h"
@ -751,9 +755,11 @@ nsSocketTransport::ResolveHost()
PR_SetNetAddr(PR_IpAddrAny, PR_AF_INET6, SocketPort(), mNetAddr);
memcpy(&mNetAddr->ipv6.ip, &addr, sizeof(addr));
#ifdef PR_LOGGING
char buf[128];
PR_NetAddrToString(mNetAddr, buf, sizeof(buf));
LOG((" -> using cached ip address [%s]\n", buf));
if (LOG_ENABLED()) {
char buf[128];
PR_NetAddrToString(mNetAddr, buf, sizeof(buf));
LOG((" -> using cached ip address [%s]\n", buf));
}
#endif
// suppress resolving status message since we are bypassing that step.
mState = STATE_RESOLVING;
@ -1027,9 +1033,11 @@ nsSocketTransport::RecoverFromError()
if (nextAddr) {
mNetAddr = nextAddr;
#if defined(PR_LOGGING)
char buf[64];
PR_NetAddrToString(mNetAddr, buf, sizeof(buf));
LOG((" ...trying next address: %s\n", buf));
if (LOG_ENABLED()) {
char buf[64];
PR_NetAddrToString(mNetAddr, buf, sizeof(buf));
LOG((" ...trying next address: %s\n", buf));
}
#endif
tryAgain = PR_TRUE;
}
@ -1615,9 +1623,11 @@ nsSocketTransport::OnFound(nsISupports *ctx,
PR_ConvertIPv4AddrToIPv6(*(PRUint32 *)(*addrList), &addr->ipv6.ip);
++addrList;
#if defined(PR_LOGGING)
char buf[50];
PR_NetAddrToString(addr, buf, sizeof(buf));
LOG((" => %s\n", buf));
if (LOG_ENABLED()) {
char buf[50];
PR_NetAddrToString(addr, buf, sizeof(buf));
LOG((" => %s\n", buf));
}
#endif
}

View File

@ -35,6 +35,10 @@
*
* ***** END LICENSE BLOCK ***** */
#ifdef MOZ_LOGGING
#define FORCE_PR_LOG
#endif
#include "nsSocketTransportService2.h"
#include "nsSocketTransport2.h"
#include "nsPrintfCString.h"
@ -42,7 +46,6 @@
#include "nsAutoLock.h"
#include "nsNetError.h"
#include "prlock.h"
#include "prlog.h"
#include "prerror.h"
#include "plstr.h"

View File

@ -54,10 +54,9 @@
// set NSPR_LOG_MODULES=nsSocketTransport:5
//
extern PRLogModuleInfo *gSocketTransportLog;
#define LOG(args) PR_LOG(gSocketTransportLog, PR_LOG_DEBUG, args)
#else
#define LOG(args)
#endif
#define LOG(args) PR_LOG(gSocketTransportLog, PR_LOG_DEBUG, args)
#define LOG_ENABLED() PR_LOG_TEST(gSocketTransportLog, PR_LOG_DEBUG)
//-----------------------------------------------------------------------------

View File

@ -79,6 +79,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsStreamTransportService, Init)
#include "nsSocketTransportService2.h"
#undef LOG
#undef LOG_ENABLED
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSocketTransportService, Init)
#include "nsAsyncStreamCopier.h"
@ -133,6 +134,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsStreamListenerTee)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsHttpNTLMAuth, Init)
#endif
#undef LOG
#undef LOG_ENABLED
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsHttpHandler, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsHttpsHandler, Init)