diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-16 01:05:46 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-16 01:05:46 +0000 |
commit | b30a3f5c4fc1e62eaffa8db57bc5681665df3643 (patch) | |
tree | b5703b6ef2d6e879473861f0d85252f813144749 /net/socket | |
parent | fe62fc852bd3c1c162ee1f41992096f59387dc31 (diff) | |
download | chromium_src-b30a3f5c4fc1e62eaffa8db57bc5681665df3643.zip chromium_src-b30a3f5c4fc1e62eaffa8db57bc5681665df3643.tar.gz chromium_src-b30a3f5c4fc1e62eaffa8db57bc5681665df3643.tar.bz2 |
Convert LOG(INFO) to VLOG(1) - net/.
Also converts COOKIE_DLOG (since VLOG can be toggled on a granular basis), removes some unneeded "endl"s and {}s, aligns "<<"s per style guide, and changes KeygenHandler::GenKeyAndSignChallenge() to avoid using "goto".
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3846001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62831 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket')
-rw-r--r-- | net/socket/socket_test_util.cc | 75 | ||||
-rw-r--r-- | net/socket/socks_client_socket.cc | 10 | ||||
-rw-r--r-- | net/socket/ssl_client_socket_mac.cc | 23 | ||||
-rw-r--r-- | net/socket/ssl_client_socket_nss.cc | 46 | ||||
-rw-r--r-- | net/socket/ssl_client_socket_openssl.cc | 2 | ||||
-rw-r--r-- | net/socket/tcp_client_socket_libevent.cc | 8 | ||||
-rw-r--r-- | net/socket/tcp_client_socket_win.cc | 2 |
7 files changed, 82 insertions, 84 deletions
diff --git a/net/socket/socket_test_util.cc b/net/socket/socket_test_util.cc index 414d395..6f03706 100644 --- a/net/socket/socket_test_util.cc +++ b/net/socket/socket_test_util.cc @@ -48,54 +48,54 @@ inline char Asciify(char x) { void DumpData(const char* data, int data_len) { if (logging::LOG_INFO < logging::GetMinLogLevel()) return; - DLOG(INFO) << "Length: " << data_len; + DVLOG(1) << "Length: " << data_len; const char* pfx = "Data: "; if (!data || (data_len <= 0)) { - DLOG(INFO) << pfx << "<None>"; + DVLOG(1) << pfx << "<None>"; } else { int i; for (i = 0; i <= (data_len - 4); i += 4) { - DLOG(INFO) << pfx + DVLOG(1) << pfx + << AsciifyHigh(data[i + 0]) << AsciifyLow(data[i + 0]) + << AsciifyHigh(data[i + 1]) << AsciifyLow(data[i + 1]) + << AsciifyHigh(data[i + 2]) << AsciifyLow(data[i + 2]) + << AsciifyHigh(data[i + 3]) << AsciifyLow(data[i + 3]) + << " '" + << Asciify(data[i + 0]) + << Asciify(data[i + 1]) + << Asciify(data[i + 2]) + << Asciify(data[i + 3]) + << "'"; + pfx = " "; + } + // Take care of any 'trailing' bytes, if data_len was not a multiple of 4. + switch (data_len - i) { + case 3: + DVLOG(1) << pfx << AsciifyHigh(data[i + 0]) << AsciifyLow(data[i + 0]) << AsciifyHigh(data[i + 1]) << AsciifyLow(data[i + 1]) << AsciifyHigh(data[i + 2]) << AsciifyLow(data[i + 2]) - << AsciifyHigh(data[i + 3]) << AsciifyLow(data[i + 3]) - << " '" + << " '" << Asciify(data[i + 0]) << Asciify(data[i + 1]) << Asciify(data[i + 2]) - << Asciify(data[i + 3]) - << "'"; - pfx = " "; - } - // Take care of any 'trailing' bytes, if data_len was not a multiple of 4. - switch (data_len - i) { - case 3: - DLOG(INFO) << pfx - << AsciifyHigh(data[i + 0]) << AsciifyLow(data[i + 0]) - << AsciifyHigh(data[i + 1]) << AsciifyLow(data[i + 1]) - << AsciifyHigh(data[i + 2]) << AsciifyLow(data[i + 2]) - << " '" - << Asciify(data[i + 0]) - << Asciify(data[i + 1]) - << Asciify(data[i + 2]) - << " '"; + << " '"; break; case 2: - DLOG(INFO) << pfx - << AsciifyHigh(data[i + 0]) << AsciifyLow(data[i + 0]) - << AsciifyHigh(data[i + 1]) << AsciifyLow(data[i + 1]) - << " '" - << Asciify(data[i + 0]) - << Asciify(data[i + 1]) - << " '"; + DVLOG(1) << pfx + << AsciifyHigh(data[i + 0]) << AsciifyLow(data[i + 0]) + << AsciifyHigh(data[i + 1]) << AsciifyLow(data[i + 1]) + << " '" + << Asciify(data[i + 0]) + << Asciify(data[i + 1]) + << " '"; break; case 1: - DLOG(INFO) << pfx - << AsciifyHigh(data[i + 0]) << AsciifyLow(data[i + 0]) - << " '" - << Asciify(data[i + 0]) - << " '"; + DVLOG(1) << pfx + << AsciifyHigh(data[i + 0]) << AsciifyLow(data[i + 0]) + << " '" + << Asciify(data[i + 0]) + << " '"; break; } } @@ -104,13 +104,12 @@ void DumpData(const char* data, int data_len) { void DumpMockRead(const MockRead& r) { if (logging::LOG_INFO < logging::GetMinLogLevel()) return; - DLOG(INFO) << "Async: " << r.async; - DLOG(INFO) << "Result: " << r.result; + DVLOG(1) << "Async: " << r.async + << "\nResult: " << r.result; DumpData(r.data, r.data_len); const char* stop = (r.sequence_number & MockRead::STOPLOOP) ? " (STOP)" : ""; - DLOG(INFO) << "Stage: " << (r.sequence_number & ~MockRead::STOPLOOP) - << stop; - DLOG(INFO) << "Time: " << r.time_stamp.ToInternalValue(); + DVLOG(1) << "Stage: " << (r.sequence_number & ~MockRead::STOPLOOP) << stop + << "\nTime: " << r.time_stamp.ToInternalValue(); } } // namespace diff --git a/net/socket/socks_client_socket.cc b/net/socket/socks_client_socket.cc index 8e9e675..1d045e1 100644 --- a/net/socket/socks_client_socket.cc +++ b/net/socket/socks_client_socket.cc @@ -203,7 +203,7 @@ void SOCKSClientSocket::DoCallback(int result) { // clear user_callback_ up front. CompletionCallback* c = user_callback_; user_callback_ = NULL; - DLOG(INFO) << "Finished setting up SOCKS handshake"; + DVLOG(1) << "Finished setting up SOCKS handshake"; c->Run(result); } @@ -273,14 +273,14 @@ int SOCKSClientSocket::DoResolveHostComplete(int result) { // since IPv6 is unsupported by SOCKS4/4a protocol. struct sockaddr *host_info = addresses_.head()->ai_addr; if (host_info->sa_family == AF_INET) { - DLOG(INFO) << "Resolved host. Using SOCKS4 to communicate"; + DVLOG(1) << "Resolved host. Using SOCKS4 to communicate"; socks_version_ = kSOCKS4; } else { - DLOG(INFO) << "Resolved host but to IPv6. Using SOCKS4a to communicate"; + DVLOG(1) << "Resolved host but to IPv6. Using SOCKS4a to communicate"; socks_version_ = kSOCKS4a; } } else { - DLOG(INFO) << "Could not resolve host. Using SOCKS4a to communicate"; + DVLOG(1) << "Could not resolve host. Using SOCKS4a to communicate"; socks_version_ = kSOCKS4a; } @@ -309,7 +309,7 @@ const std::string SOCKSClientSocket::BuildHandshakeWriteBuffer() const { reinterpret_cast<struct sockaddr_in*>(ai->ai_addr); memcpy(&request.ip, &(ipv4_host->sin_addr), sizeof(ipv4_host->sin_addr)); - DLOG(INFO) << "Resolved Host is : " << NetAddressToString(ai); + DVLOG(1) << "Resolved Host is : " << NetAddressToString(ai); } else if (socks_version_ == kSOCKS4a) { // invalid IP of the form 0.0.0.127 memcpy(&request.ip, kInvalidIp, arraysize(kInvalidIp)); diff --git a/net/socket/ssl_client_socket_mac.cc b/net/socket/ssl_client_socket_mac.cc index 884555c..9a60907 100644 --- a/net/socket/ssl_client_socket_mac.cc +++ b/net/socket/ssl_client_socket_mac.cc @@ -104,9 +104,6 @@ namespace { const unsigned int kWriteSizePauseLimit = 2 * 1024 * 1024; const unsigned int kWriteSizeResumeLimit = 1 * 1024 * 1024; -// You can change this to LOG(WARNING) during development. -#define SSL_LOG LOG(INFO) << "SSL: " - #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5 // When compiled against the Mac OS X 10.5 SDK, define symbolic constants for // cipher suites added in Mac OS X 10.6. @@ -555,7 +552,7 @@ void SSLClientSocketMac::Disconnect() { SSLClose(ssl_context_); SSLDisposeContext(ssl_context_); ssl_context_ = NULL; - SSL_LOG << "----- Disposed SSLContext"; + VLOG(1) << "----- Disposed SSLContext"; } // Shut down anything that may call us back. @@ -694,7 +691,7 @@ void SSLClientSocketMac::GetSSLCertRequestInfo( CFArrayRef valid_issuer_names = NULL; if (SSLCopyDistinguishedNames(ssl_context_, &valid_issuer_names) == noErr && valid_issuer_names != NULL) { - SSL_LOG << "Server has " << CFArrayGetCount(valid_issuer_names) + VLOG(1) << "Server has " << CFArrayGetCount(valid_issuer_names) << " valid issuer names"; int n = CFArrayGetCount(valid_issuer_names); for (int i = 0; i < n; i++) { @@ -716,7 +713,7 @@ void SSLClientSocketMac::GetSSLCertRequestInfo( X509Certificate::GetSSLClientCertificates(hostname_, valid_issuers, &cert_request_info->client_certs); - SSL_LOG << "Asking user to choose between " + VLOG(1) << "Asking user to choose between " << cert_request_info->client_certs.size() << " client certs..."; } @@ -727,7 +724,7 @@ SSLClientSocketMac::GetNextProto(std::string* proto) { } int SSLClientSocketMac::InitializeSSLContext() { - SSL_LOG << "----- InitializeSSLContext"; + VLOG(1) << "----- InitializeSSLContext"; OSStatus status = noErr; status = SSLNewContext(false, &ssl_context_); @@ -975,7 +972,7 @@ int SSLClientSocketMac::DoHandshake() { if (client_cert_requested_) { // See if the server aborted due to client cert checking. if (!ssl_config_.send_client_cert) { - SSL_LOG << "Server requested SSL cert during handshake"; + VLOG(1) << "Server requested SSL cert during handshake"; return ERR_SSL_CLIENT_AUTH_CERT_NEEDED; } LOG(WARNING) << "Server aborted SSL handshake"; @@ -1002,7 +999,7 @@ int SSLClientSocketMac::DoVerifyCert() { DCHECK(server_cert_); - SSL_LOG << "DoVerifyCert..."; + VLOG(1) << "DoVerifyCert..."; int flags = 0; if (ssl_config_.rev_checking_enabled) flags |= X509Certificate::VERIFY_REV_CHECKING_ENABLED; @@ -1018,7 +1015,7 @@ int SSLClientSocketMac::DoVerifyCertComplete(int result) { DCHECK(verifier_.get()); verifier_.reset(); - SSL_LOG << "...DoVerifyCertComplete (result=" << result << ")"; + VLOG(1) << "...DoVerifyCertComplete (result=" << result << ")"; if (IsCertificateError(result) && ssl_config_.IsAllowedBadCert(server_cert_)) result = OK; @@ -1028,7 +1025,7 @@ int SSLClientSocketMac::DoVerifyCertComplete(int result) { // asking for one, and abort the connection. return ERR_SSL_CLIENT_AUTH_CERT_NEEDED; } - SSL_LOG << "Handshake finished! (DoVerifyCertComplete)"; + VLOG(1) << "Handshake finished! (DoVerifyCertComplete)"; if (renegotiating_) { DidCompleteRenegotiation(); @@ -1047,7 +1044,7 @@ int SSLClientSocketMac::SetClientCert() { scoped_cftyperef<CFArrayRef> cert_refs( ssl_config_.client_cert->CreateClientCertificateChain()); - SSL_LOG << "SSLSetCertificate(" << CFArrayGetCount(cert_refs) << " certs)"; + VLOG(1) << "SSLSetCertificate(" << CFArrayGetCount(cert_refs) << " certs)"; OSStatus result = SSLSetCertificate(ssl_context_, cert_refs); if (result) LOG(ERROR) << "SSLSetCertificate returned OSStatus " << result; @@ -1121,7 +1118,7 @@ void SSLClientSocketMac::DidCompleteRenegotiation() { int SSLClientSocketMac::DidCompleteHandshake() { DCHECK(!server_cert_ || renegotiating_); - SSL_LOG << "Handshake completed, next verify cert"; + VLOG(1) << "Handshake completed, next verify cert"; scoped_refptr<X509Certificate> new_server_cert = GetServerCert(ssl_context_); diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc index 9766654..39a2774 100644 --- a/net/socket/ssl_client_socket_nss.cc +++ b/net/socket/ssl_client_socket_nss.cc @@ -107,18 +107,20 @@ namespace net { #define GotoState(s) next_handshake_state_ = s #define LogData(s, len) #else -#define EnterFunction(x) LOG(INFO) << (void *)this << " " << __FUNCTION__ << \ - " enter " << x << \ - "; next_handshake_state " << next_handshake_state_ -#define LeaveFunction(x) LOG(INFO) << (void *)this << " " << __FUNCTION__ << \ - " leave " << x << \ - "; next_handshake_state " << next_handshake_state_ -#define GotoState(s) do { LOG(INFO) << (void *)this << " " << __FUNCTION__ << \ - " jump to state " << s; \ - next_handshake_state_ = s; } while (0) -#define LogData(s, len) LOG(INFO) << (void *)this << " " << __FUNCTION__ << \ - " data [" << std::string(s, len) << "]"; - +#define EnterFunction(x)\ + VLOG(1) << (void *)this << " " << __FUNCTION__ << " enter " << x\ + << "; next_handshake_state " << next_handshake_state_ +#define LeaveFunction(x)\ + VLOG(1) << (void *)this << " " << __FUNCTION__ << " leave " << x\ + << "; next_handshake_state " << next_handshake_state_ +#define GotoState(s)\ + do {\ + VLOG(1) << (void *)this << " " << __FUNCTION__ << " jump to state " << s;\ + next_handshake_state_ = s;\ + } while (0) +#define LogData(s, len)\ + VLOG(1) << (void *)this << " " << __FUNCTION__\ + << " data [" << std::string(s, len) << "]" #endif namespace { @@ -363,7 +365,7 @@ bool IsProblematicComodoEVCACert(const CERTCertificate& cert) { // http://blogs.msdn.com/b/askie/archive/2009/06/09/my-expired-client-certificates-no-longer-display-when-connecting-to-my-web-server-using-ie8.aspx BOOL WINAPI ClientCertFindCallback(PCCERT_CONTEXT cert_context, void* find_arg) { - LOG(INFO) << "Calling ClientCertFindCallback from _nss"; + VLOG(1) << "Calling ClientCertFindCallback from _nss"; // Verify the certificate's KU is good. BYTE key_usage; if (CertGetIntendedKeyUsage(X509_ASN_ENCODING, cert_context->pCertInfo, @@ -872,7 +874,7 @@ int SSLClientSocketNSS::InitializeSSLOptions() { rv = SSL_OptionSet(nss_fd_, SSL_ENABLE_SNAP_START, SSLConfigService::snap_start_enabled()); if (rv != SECSuccess) - LOG(INFO) << "SSL_ENABLE_SNAP_START failed. Old system nss?"; + VLOG(1) << "SSL_ENABLE_SNAP_START failed. Old system nss?"; #endif #ifdef SSL_ENABLE_RENEGOTIATION @@ -1245,8 +1247,8 @@ void SSLClientSocketNSS::CheckSecureRenegotiation() const { if (SSL_HandshakeNegotiatedExtension(nss_fd_, ssl_renegotiation_info_xtn, &received_renego_info) == SECSuccess && !received_renego_info) { - LOG(INFO) << "The server " << hostname_ - << " does not support the TLS renegotiation_info extension."; + VLOG(1) << "The server " << hostname_ + << " does not support the TLS renegotiation_info extension."; } #endif } @@ -2052,11 +2054,11 @@ int SSLClientSocketNSS::DoHandshake() { net_error = ERR_NETNANNY_SSL_INTERCEPTION; } else { SaveSnapStartInfo(); - // SSL handshake is completed. It's possible that we mispredicted the NPN - // agreed protocol. In this case, we've just sent a request in the wrong - // protocol! The higher levels of this network stack aren't prepared for - // switching the protocol like that so we make up an error and rely on - // the fact that the request will be retried. + // SSL handshake is completed. It's possible that we mispredicted the + // NPN agreed protocol. In this case, we've just sent a request in the + // wrong protocol! The higher levels of this network stack aren't + // prepared for switching the protocol like that so we make up an error + // and rely on the fact that the request will be retried. if (IsNPNProtocolMispredicted()) { LOG(WARNING) << "Mispredicted NPN protocol for " << hostname_; net_error = ERR_SSL_SNAP_START_NPN_MISPREDICTION; @@ -2379,7 +2381,7 @@ int SSLClientSocketNSS::DoVerifyCertComplete(int result) { // the cert in the allowed_bad_certs vector. if (IsCertificateError(result) && ssl_config_.IsAllowedBadCert(server_cert_)) { - LOG(INFO) << "accepting bad SSL certificate, as user told us to"; + VLOG(1) << "accepting bad SSL certificate, as user told us to"; result = OK; } diff --git a/net/socket/ssl_client_socket_openssl.cc b/net/socket/ssl_client_socket_openssl.cc index 64852f2..bbe3ee4 100644 --- a/net/socket/ssl_client_socket_openssl.cc +++ b/net/socket/ssl_client_socket_openssl.cc @@ -372,7 +372,7 @@ int SSLClientSocketOpenSSL::DoVerifyCertComplete(int result) { // the cert in the allowed_bad_certs vector. if (IsCertificateError(result) && ssl_config_.IsAllowedBadCert(server_cert_)) { - LOG(INFO) << "accepting bad SSL certificate, as user told us to"; + VLOG(1) << "accepting bad SSL certificate, as user told us to"; result = OK; } diff --git a/net/socket/tcp_client_socket_libevent.cc b/net/socket/tcp_client_socket_libevent.cc index f896ac6..aedbf8a 100644 --- a/net/socket/tcp_client_socket_libevent.cc +++ b/net/socket/tcp_client_socket_libevent.cc @@ -223,7 +223,7 @@ int TCPClientSocketLibevent::DoConnect() { socket_, true, MessageLoopForIO::WATCH_WRITE, &write_socket_watcher_, &write_watcher_)) { connect_os_error_ = errno; - DLOG(INFO) << "WatchFileDescriptor failed: " << connect_os_error_; + DVLOG(1) << "WatchFileDescriptor failed: " << connect_os_error_; return MapPosixError(connect_os_error_); } @@ -337,14 +337,14 @@ int TCPClientSocketLibevent::Read(IOBuffer* buf, return nread; } if (errno != EAGAIN && errno != EWOULDBLOCK) { - DLOG(INFO) << "read failed, errno " << errno; + DVLOG(1) << "read failed, errno " << errno; return MapPosixError(errno); } if (!MessageLoopForIO::current()->WatchFileDescriptor( socket_, true, MessageLoopForIO::WATCH_READ, &read_socket_watcher_, &read_watcher_)) { - DLOG(INFO) << "WatchFileDescriptor failed on read, errno " << errno; + DVLOG(1) << "WatchFileDescriptor failed on read, errno " << errno; return MapPosixError(errno); } @@ -381,7 +381,7 @@ int TCPClientSocketLibevent::Write(IOBuffer* buf, if (!MessageLoopForIO::current()->WatchFileDescriptor( socket_, true, MessageLoopForIO::WATCH_WRITE, &write_socket_watcher_, &write_watcher_)) { - DLOG(INFO) << "WatchFileDescriptor failed on write, errno " << errno; + DVLOG(1) << "WatchFileDescriptor failed on write, errno " << errno; return MapPosixError(errno); } diff --git a/net/socket/tcp_client_socket_win.cc b/net/socket/tcp_client_socket_win.cc index fc6ca27..9143b81 100644 --- a/net/socket/tcp_client_socket_win.cc +++ b/net/socket/tcp_client_socket_win.cc @@ -35,7 +35,7 @@ void AssertEventNotSignaled(WSAEVENT hEvent) { // This LOG statement is unreachable since we have already crashed, but it // should prevent the compiler from optimizing away the |wait_rv| and // |err| variables so they appear nicely on the stack in crash dumps. - LOG(INFO) << "wait_rv=" << wait_rv << ", err=" << err; + VLOG(1) << "wait_rv=" << wait_rv << ", err=" << err; } } |