OLD | NEW |
---|---|
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/socket_test_util.h" | 5 #include "net/socket/socket_test_util.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 | 10 |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
354 MockSSLClientSocket::~MockSSLClientSocket() { | 354 MockSSLClientSocket::~MockSSLClientSocket() { |
355 Disconnect(); | 355 Disconnect(); |
356 } | 356 } |
357 | 357 |
358 int MockSSLClientSocket::Connect(net::CompletionCallback* callback) { | 358 int MockSSLClientSocket::Connect(net::CompletionCallback* callback) { |
359 ConnectCallback* connect_callback = new ConnectCallback( | 359 ConnectCallback* connect_callback = new ConnectCallback( |
360 this, callback, data_->connect.result); | 360 this, callback, data_->connect.result); |
361 int rv = transport_->socket()->Connect(connect_callback); | 361 int rv = transport_->socket()->Connect(connect_callback); |
362 if (rv == net::OK) { | 362 if (rv == net::OK) { |
363 delete connect_callback; | 363 delete connect_callback; |
364 if (data_->connect.result == net::OK) | |
365 connected_ = true; | |
eroman
2010/08/21 02:48:09
It would be better to only set connected_ to true
| |
364 if (data_->connect.async) { | 366 if (data_->connect.async) { |
365 RunCallbackAsync(callback, data_->connect.result); | 367 RunCallbackAsync(callback, data_->connect.result); |
366 return net::ERR_IO_PENDING; | 368 return net::ERR_IO_PENDING; |
367 } | 369 } |
368 if (data_->connect.result == net::OK) | |
369 connected_ = true; | |
370 return data_->connect.result; | 370 return data_->connect.result; |
371 } | 371 } |
372 return rv; | 372 return rv; |
373 } | 373 } |
374 | 374 |
375 void MockSSLClientSocket::Disconnect() { | 375 void MockSSLClientSocket::Disconnect() { |
376 MockClientSocket::Disconnect(); | 376 MockClientSocket::Disconnect(); |
377 if (transport_->socket() != NULL) | 377 if (transport_->socket() != NULL) |
378 transport_->socket()->Disconnect(); | 378 transport_->socket()->Disconnect(); |
379 } | 379 } |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
900 | 900 |
901 const char kSOCKS5OkRequest[] = | 901 const char kSOCKS5OkRequest[] = |
902 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; | 902 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; |
903 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); | 903 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); |
904 | 904 |
905 const char kSOCKS5OkResponse[] = | 905 const char kSOCKS5OkResponse[] = |
906 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; | 906 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; |
907 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); | 907 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); |
908 | 908 |
909 } // namespace net | 909 } // namespace net |
OLD | NEW |