Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: net/socket_stream/socket_stream.cc

Issue 344026: Add LoadLog to ClientSocket::Connect(). (Closed)
Patch Set: Minor build fixups and fixed mac bug. Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/socket/tcp_pinger.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // TODO(ukai): code is similar with http_network_transaction.cc. We should 5 // TODO(ukai): code is similar with http_network_transaction.cc. We should
6 // think about ways to share code, if possible. 6 // think about ways to share code, if possible.
7 7
8 #include "net/socket_stream/socket_stream.h" 8 #include "net/socket_stream/socket_stream.h"
9 9
10 #include <string> 10 #include <string>
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 else 412 else
413 next_state_ = STATE_CLOSE; 413 next_state_ = STATE_CLOSE;
414 // TODO(ukai): if error occured, reconsider proxy after error. 414 // TODO(ukai): if error occured, reconsider proxy after error.
415 return result; 415 return result;
416 } 416 }
417 417
418 int SocketStream::DoTcpConnect() { 418 int SocketStream::DoTcpConnect() {
419 next_state_ = STATE_TCP_CONNECT_COMPLETE; 419 next_state_ = STATE_TCP_CONNECT_COMPLETE;
420 DCHECK(factory_); 420 DCHECK(factory_);
421 socket_.reset(factory_->CreateTCPClientSocket(addresses_)); 421 socket_.reset(factory_->CreateTCPClientSocket(addresses_));
422 return socket_->Connect(&io_callback_); 422 // TODO(willchan): Plumb LoadLog into SocketStream.
423 return socket_->Connect(&io_callback_, NULL);
423 } 424 }
424 425
425 int SocketStream::DoTcpConnectComplete(int result) { 426 int SocketStream::DoTcpConnectComplete(int result) {
426 // TODO(ukai): if error occured, reconsider proxy after error. 427 // TODO(ukai): if error occured, reconsider proxy after error.
427 if (result != OK) { 428 if (result != OK) {
428 next_state_ = STATE_CLOSE; 429 next_state_ = STATE_CLOSE;
429 return result; 430 return result;
430 } 431 }
431 432
432 if (proxy_mode_ == kTunnelProxy) 433 if (proxy_mode_ == kTunnelProxy)
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 620
620 ClientSocket* s = socket_.release(); 621 ClientSocket* s = socket_.release();
621 HostResolver::RequestInfo req_info(url_.HostNoBrackets(), 622 HostResolver::RequestInfo req_info(url_.HostNoBrackets(),
622 url_.EffectiveIntPort()); 623 url_.EffectiveIntPort());
623 624
624 if (proxy_info_.proxy_server().scheme() == ProxyServer::SCHEME_SOCKS5) 625 if (proxy_info_.proxy_server().scheme() == ProxyServer::SCHEME_SOCKS5)
625 s = new SOCKS5ClientSocket(s, req_info, host_resolver_.get()); 626 s = new SOCKS5ClientSocket(s, req_info, host_resolver_.get());
626 else 627 else
627 s = new SOCKSClientSocket(s, req_info, host_resolver_.get()); 628 s = new SOCKSClientSocket(s, req_info, host_resolver_.get());
628 socket_.reset(s); 629 socket_.reset(s);
629 return socket_->Connect(&io_callback_); 630 // TODO(willchan): Plumb LoadLog into SocketStream.
631 return socket_->Connect(&io_callback_, NULL);
630 } 632 }
631 633
632 int SocketStream::DoSOCKSConnectComplete(int result) { 634 int SocketStream::DoSOCKSConnectComplete(int result) {
633 DCHECK_EQ(kSOCKSProxy, proxy_mode_); 635 DCHECK_EQ(kSOCKSProxy, proxy_mode_);
634 636
635 if (result == OK) { 637 if (result == OK) {
636 if (is_secure()) 638 if (is_secure())
637 next_state_ = STATE_SSL_CONNECT; 639 next_state_ = STATE_SSL_CONNECT;
638 else 640 else
639 DidEstablishConnection(); 641 DidEstablishConnection();
640 } 642 }
641 return result; 643 return result;
642 } 644 }
643 645
644 int SocketStream::DoSSLConnect() { 646 int SocketStream::DoSSLConnect() {
645 DCHECK(factory_); 647 DCHECK(factory_);
646 socket_.reset(factory_->CreateSSLClientSocket( 648 socket_.reset(factory_->CreateSSLClientSocket(
647 socket_.release(), url_.HostNoBrackets(), ssl_config_)); 649 socket_.release(), url_.HostNoBrackets(), ssl_config_));
648 next_state_ = STATE_SSL_CONNECT_COMPLETE; 650 next_state_ = STATE_SSL_CONNECT_COMPLETE;
649 return socket_->Connect(&io_callback_); 651 // TODO(willchan): Plumb LoadLog into SocketStream.
652 return socket_->Connect(&io_callback_, NULL);
650 } 653 }
651 654
652 int SocketStream::DoSSLConnectComplete(int result) { 655 int SocketStream::DoSSLConnectComplete(int result) {
653 if (IsCertificateError(result)) 656 if (IsCertificateError(result))
654 result = HandleCertificateError(result); 657 result = HandleCertificateError(result);
655 658
656 if (result == OK) 659 if (result == OK)
657 result = DidEstablishConnection(); 660 result = DidEstablishConnection();
658 else 661 else
659 next_state_ = STATE_CLOSE; 662 next_state_ = STATE_CLOSE;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 809
807 SSLConfigService* SocketStream::ssl_config_service() const { 810 SSLConfigService* SocketStream::ssl_config_service() const {
808 return context_->ssl_config_service(); 811 return context_->ssl_config_service();
809 } 812 }
810 813
811 ProxyService* SocketStream::proxy_service() const { 814 ProxyService* SocketStream::proxy_service() const {
812 return context_->proxy_service(); 815 return context_->proxy_service();
813 } 816 }
814 817
815 } // namespace net 818 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/tcp_pinger.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698