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.h" | 5 #include "net/socket/tcp_client_socket.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <netdb.h> | 9 #include <netdb.h> |
| 10 #include <sys/socket.h> | 10 #include <sys/socket.h> |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 if (tcp_fastopen_connected_) { | 155 if (tcp_fastopen_connected_) { |
| 156 UMA_HISTOGRAM_ENUMERATION("Net.TcpFastOpenSocketConnection", | 156 UMA_HISTOGRAM_ENUMERATION("Net.TcpFastOpenSocketConnection", |
| 157 fast_open_status_, FAST_OPEN_MAX_VALUE); | 157 fast_open_status_, FAST_OPEN_MAX_VALUE); |
| 158 } | 158 } |
| 159 } | 159 } |
| 160 | 160 |
| 161 int TCPClientSocketLibevent::AdoptSocket(int socket) { | 161 int TCPClientSocketLibevent::AdoptSocket(int socket) { |
| 162 DCHECK_EQ(socket_, kInvalidSocket); | 162 DCHECK_EQ(socket_, kInvalidSocket); |
| 163 | 163 |
| 164 int error = SetupSocket(socket); | 164 int error = SetupSocket(socket); |
| 165 if (error) | 165 if (error) { |
| 166 if (HANDLE_EINTR(close(socket)) < 0) | |
|
akalin
2013/08/26 18:53:21
may be worth splitting off this into its own chang
yzshen1
2013/08/26 23:09:57
Done.
akalin
2013/08/26 23:29:15
Do you have a link to the new change? Or were you
| |
| 167 PLOG(ERROR) << "close"; | |
| 166 return MapSystemError(error); | 168 return MapSystemError(error); |
| 169 } | |
| 167 | 170 |
| 168 socket_ = socket; | 171 socket_ = socket; |
| 169 | 172 |
| 170 // This is to make GetPeerAddress() work. It's up to the caller ensure | 173 // This is to make GetPeerAddress() work. It's up to the caller ensure |
| 171 // that |address_| contains a reasonable address for this | 174 // that |address_| contains a reasonable address for this |
| 172 // socket. (i.e. at least match IPv4 vs IPv6!). | 175 // socket. (i.e. at least match IPv4 vs IPv6!). |
| 173 current_address_index_ = 0; | 176 current_address_index_ = 0; |
| 174 use_history_.set_was_ever_connected(); | 177 use_history_.set_was_ever_connected(); |
| 175 | 178 |
| 176 return OK; | 179 return OK; |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 821 | 824 |
| 822 NextProto TCPClientSocketLibevent::GetNegotiatedProtocol() const { | 825 NextProto TCPClientSocketLibevent::GetNegotiatedProtocol() const { |
| 823 return kProtoUnknown; | 826 return kProtoUnknown; |
| 824 } | 827 } |
| 825 | 828 |
| 826 bool TCPClientSocketLibevent::GetSSLInfo(SSLInfo* ssl_info) { | 829 bool TCPClientSocketLibevent::GetSSLInfo(SSLInfo* ssl_info) { |
| 827 return false; | 830 return false; |
| 828 } | 831 } |
| 829 | 832 |
| 830 } // namespace net | 833 } // namespace net |
| OLD | NEW |