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

Side by Side Diff: net/socket/socks5_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/socks5_client_socket.h" 5 #include "net/socket/socks5_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/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 transport_->set_socket(transport_socket); 60 transport_->set_socket(transport_socket);
61 } 61 }
62 62
63 SOCKS5ClientSocket::~SOCKS5ClientSocket() { 63 SOCKS5ClientSocket::~SOCKS5ClientSocket() {
64 Disconnect(); 64 Disconnect();
65 } 65 }
66 66
67 int SOCKS5ClientSocket::Connect(CompletionCallback* callback) { 67 int SOCKS5ClientSocket::Connect(CompletionCallback* callback) {
68 DCHECK(transport_.get()); 68 DCHECK(transport_.get());
69 DCHECK(transport_->socket()); 69 DCHECK(transport_->socket());
70 DCHECK(transport_->socket()->IsConnected());
71 DCHECK_EQ(STATE_NONE, next_state_); 70 DCHECK_EQ(STATE_NONE, next_state_);
72 DCHECK(!user_callback_); 71 DCHECK(!user_callback_);
73 72
74 // If already connected, then just return OK. 73 // If already connected, then just return OK.
75 if (completed_handshake_) 74 if (completed_handshake_)
76 return OK; 75 return OK;
77 76
78 net_log_.BeginEvent(NetLog::TYPE_SOCKS5_CONNECT, NULL); 77 net_log_.BeginEvent(NetLog::TYPE_SOCKS5_CONNECT, NULL);
79 78
80 next_state_ = STATE_GREET_WRITE; 79 next_state_ = STATE_GREET_WRITE;
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 431
433 next_state_ = STATE_HANDSHAKE_READ; 432 next_state_ = STATE_HANDSHAKE_READ;
434 return OK; 433 return OK;
435 } 434 }
436 435
437 int SOCKS5ClientSocket::GetPeerAddress(AddressList* address) const { 436 int SOCKS5ClientSocket::GetPeerAddress(AddressList* address) const {
438 return transport_->socket()->GetPeerAddress(address); 437 return transport_->socket()->GetPeerAddress(address);
439 } 438 }
440 439
441 } // namespace net 440 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698