OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_socket.h" |
5 #include "net/socket/tcp_socket_win.h" | 6 #include "net/socket/tcp_socket_win.h" |
6 | 7 |
7 #include <mstcpip.h> | 8 #include <mstcpip.h> |
8 | 9 |
9 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
11 #include "base/metrics/stats_counters.h" | 12 #include "base/metrics/stats_counters.h" |
12 #include "base/win/windows_version.h" | 13 #include "base/win/windows_version.h" |
13 #include "net/base/address_list.h" | 14 #include "net/base/address_list.h" |
14 #include "net/base/connection_type_histograms.h" | 15 #include "net/base/connection_type_histograms.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 117 |
117 return net_error; | 118 return net_error; |
118 } | 119 } |
119 } | 120 } |
120 } | 121 } |
121 | 122 |
122 } // namespace | 123 } // namespace |
123 | 124 |
124 //----------------------------------------------------------------------------- | 125 //----------------------------------------------------------------------------- |
125 | 126 |
| 127 // Nothing to do for Windows since it doesn't support TCP FastOpen. |
| 128 // TODO(jri): Remove these along with the corresponding global variables. |
| 129 bool IsTCPFastOpenSupported() { return false; } |
| 130 bool IsTCPFastOpenUserEnabled() { return false; } |
| 131 void CheckSupportAndMaybeEnableTCPFastOpen(bool user_enabled) {} |
| 132 |
126 // This class encapsulates all the state that has to be preserved as long as | 133 // This class encapsulates all the state that has to be preserved as long as |
127 // there is a network IO operation in progress. If the owner TCPSocketWin is | 134 // there is a network IO operation in progress. If the owner TCPSocketWin is |
128 // destroyed while an operation is in progress, the Core is detached and it | 135 // destroyed while an operation is in progress, the Core is detached and it |
129 // lives until the operation completes and the OS doesn't reference any resource | 136 // lives until the operation completes and the OS doesn't reference any resource |
130 // declared on this class anymore. | 137 // declared on this class anymore. |
131 class TCPSocketWin::Core : public base::RefCounted<Core> { | 138 class TCPSocketWin::Core : public base::RefCounted<Core> { |
132 public: | 139 public: |
133 explicit Core(TCPSocketWin* socket); | 140 explicit Core(TCPSocketWin* socket); |
134 | 141 |
135 // Start watching for the end of a read or write operation. | 142 // Start watching for the end of a read or write operation. |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 waiting_connect_ = false; | 694 waiting_connect_ = false; |
688 waiting_read_ = false; | 695 waiting_read_ = false; |
689 waiting_write_ = false; | 696 waiting_write_ = false; |
690 | 697 |
691 read_callback_.Reset(); | 698 read_callback_.Reset(); |
692 write_callback_.Reset(); | 699 write_callback_.Reset(); |
693 peer_address_.reset(); | 700 peer_address_.reset(); |
694 connect_os_error_ = 0; | 701 connect_os_error_ = 0; |
695 } | 702 } |
696 | 703 |
697 bool TCPSocketWin::UsingTCPFastOpen() const { | |
698 // Not supported on windows. | |
699 return false; | |
700 } | |
701 | |
702 void TCPSocketWin::StartLoggingMultipleConnectAttempts( | 704 void TCPSocketWin::StartLoggingMultipleConnectAttempts( |
703 const AddressList& addresses) { | 705 const AddressList& addresses) { |
704 if (!logging_multiple_connect_attempts_) { | 706 if (!logging_multiple_connect_attempts_) { |
705 logging_multiple_connect_attempts_ = true; | 707 logging_multiple_connect_attempts_ = true; |
706 LogConnectBegin(addresses); | 708 LogConnectBegin(addresses); |
707 } else { | 709 } else { |
708 NOTREACHED(); | 710 NOTREACHED(); |
709 } | 711 } |
710 } | 712 } |
711 | 713 |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 | 1016 |
1015 waiting_read_ = false; | 1017 waiting_read_ = false; |
1016 core_->read_iobuffer_ = NULL; | 1018 core_->read_iobuffer_ = NULL; |
1017 core_->read_buffer_length_ = 0; | 1019 core_->read_buffer_length_ = 0; |
1018 | 1020 |
1019 DCHECK_NE(rv, ERR_IO_PENDING); | 1021 DCHECK_NE(rv, ERR_IO_PENDING); |
1020 base::ResetAndReturn(&read_callback_).Run(rv); | 1022 base::ResetAndReturn(&read_callback_).Run(rv); |
1021 } | 1023 } |
1022 | 1024 |
1023 } // namespace net | 1025 } // namespace net |
1024 | |
OLD | NEW |