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

Side by Side Diff: net/socket/socks_client_socket.cc

Issue 3107036: Fix a crash where we are checking IsConnected(). If you look into the ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: nits, extra EXPECTS() in test cases added Created 10 years, 3 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "net/socket/socks_client_socket.h" 5 #include "net/socket/socks_client_socket.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/trace_event.h" 9 #include "base/trace_event.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 transport_->set_socket(transport_socket); 95 transport_->set_socket(transport_socket);
96 } 96 }
97 97
98 SOCKSClientSocket::~SOCKSClientSocket() { 98 SOCKSClientSocket::~SOCKSClientSocket() {
99 Disconnect(); 99 Disconnect();
100 } 100 }
101 101
102 int SOCKSClientSocket::Connect(CompletionCallback* callback) { 102 int SOCKSClientSocket::Connect(CompletionCallback* callback) {
103 DCHECK(transport_.get()); 103 DCHECK(transport_.get());
104 DCHECK(transport_->socket()); 104 DCHECK(transport_->socket());
105 DCHECK(transport_->socket()->IsConnected());
106 DCHECK_EQ(STATE_NONE, next_state_); 105 DCHECK_EQ(STATE_NONE, next_state_);
107 DCHECK(!user_callback_); 106 DCHECK(!user_callback_);
108 107
109 // If already connected, then just return OK. 108 // If already connected, then just return OK.
110 if (completed_handshake_) 109 if (completed_handshake_)
111 return OK; 110 return OK;
112 111
113 next_state_ = STATE_RESOLVE_HOST; 112 next_state_ = STATE_RESOLVE_HOST;
114 113
115 net_log_.BeginEvent(NetLog::TYPE_SOCKS_CONNECT, NULL); 114 net_log_.BeginEvent(NetLog::TYPE_SOCKS_CONNECT, NULL);
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 } 413 }
415 414
416 // Note: we ignore the last 6 bytes as specified by the SOCKS protocol 415 // Note: we ignore the last 6 bytes as specified by the SOCKS protocol
417 } 416 }
418 417
419 int SOCKSClientSocket::GetPeerAddress(AddressList* address) const { 418 int SOCKSClientSocket::GetPeerAddress(AddressList* address) const {
420 return transport_->socket()->GetPeerAddress(address); 419 return transport_->socket()->GetPeerAddress(address);
421 } 420 }
422 421
423 } // namespace net 422 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698