Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/tcp_client_socket_win.h" | 5 #include "net/socket/tcp_client_socket_win.h" |
| 6 | 6 |
| 7 #include <mstcpip.h> | 7 #include <mstcpip.h> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | |
|
eroman
2012/06/12 05:17:26
nit: is this still used?
mmenke
2012/06/12 14:52:36
Nope. Removed.
| |
| 10 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 11 #include "base/metrics/stats_counters.h" | 12 #include "base/metrics/stats_counters.h" |
| 12 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 13 #include "base/win/object_watcher.h" | 14 #include "base/win/object_watcher.h" |
| 14 #include "base/win/windows_version.h" | 15 #include "base/win/windows_version.h" |
| 15 #include "net/base/address_list_net_log_param.h" | |
| 16 #include "net/base/connection_type_histograms.h" | 16 #include "net/base/connection_type_histograms.h" |
| 17 #include "net/base/io_buffer.h" | 17 #include "net/base/io_buffer.h" |
| 18 #include "net/base/ip_endpoint.h" | 18 #include "net/base/ip_endpoint.h" |
| 19 #include "net/base/net_errors.h" | 19 #include "net/base/net_errors.h" |
| 20 #include "net/base/net_log.h" | 20 #include "net/base/net_log.h" |
| 21 #include "net/base/net_util.h" | 21 #include "net/base/net_util.h" |
| 22 #include "net/base/network_change_notifier.h" | 22 #include "net/base/network_change_notifier.h" |
| 23 #include "net/base/winsock_init.h" | 23 #include "net/base/winsock_init.h" |
| 24 #include "net/base/winsock_util.h" | 24 #include "net/base/winsock_util.h" |
| 25 #include "net/socket/socket_error_params.h" | 25 #include "net/socket/socket_error_params.h" |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 399 DCHECK(CalledOnValidThread()); | 399 DCHECK(CalledOnValidThread()); |
| 400 | 400 |
| 401 // If already connected, then just return OK. | 401 // If already connected, then just return OK. |
| 402 if (socket_ != INVALID_SOCKET) | 402 if (socket_ != INVALID_SOCKET) |
| 403 return OK; | 403 return OK; |
| 404 | 404 |
| 405 base::StatsCounter connects("tcp.connect"); | 405 base::StatsCounter connects("tcp.connect"); |
| 406 connects.Increment(); | 406 connects.Increment(); |
| 407 | 407 |
| 408 net_log_.BeginEvent(NetLog::TYPE_TCP_CONNECT, | 408 net_log_.BeginEvent(NetLog::TYPE_TCP_CONNECT, |
| 409 new AddressListNetLogParam(addresses_)); | 409 addresses_.CreateNetLogCallback()); |
| 410 | 410 |
| 411 // We will try to connect to each address in addresses_. Start with the | 411 // We will try to connect to each address in addresses_. Start with the |
| 412 // first one in the list. | 412 // first one in the list. |
| 413 next_connect_state_ = CONNECT_STATE_CONNECT; | 413 next_connect_state_ = CONNECT_STATE_CONNECT; |
| 414 current_address_index_ = 0; | 414 current_address_index_ = 0; |
| 415 | 415 |
| 416 int rv = DoConnectLoop(OK); | 416 int rv = DoConnectLoop(OK); |
| 417 if (rv == ERR_IO_PENDING) { | 417 if (rv == ERR_IO_PENDING) { |
| 418 // Synchronous operation not supported. | 418 // Synchronous operation not supported. |
| 419 DCHECK(!callback.is_null()); | 419 DCHECK(!callback.is_null()); |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 946 use_history_.set_was_used_to_convey_data(); | 946 use_history_.set_was_used_to_convey_data(); |
| 947 net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_SENT, num_bytes, | 947 net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_SENT, num_bytes, |
| 948 core_->write_buffer_.buf); | 948 core_->write_buffer_.buf); |
| 949 } | 949 } |
| 950 } | 950 } |
| 951 core_->write_iobuffer_ = NULL; | 951 core_->write_iobuffer_ = NULL; |
| 952 DoWriteCallback(rv); | 952 DoWriteCallback(rv); |
| 953 } | 953 } |
| 954 | 954 |
| 955 } // namespace net | 955 } // namespace net |
| OLD | NEW |