| 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.h" |
| 6 #include "net/socket/tcp_socket_win.h" | 6 #include "net/socket/tcp_socket_win.h" |
| 7 | 7 |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <mstcpip.h> | 9 #include <mstcpip.h> |
| 10 | 10 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 HANDLE object) { | 235 HANDLE object) { |
| 236 DCHECK_EQ(object, core_->write_overlapped_.hEvent); | 236 DCHECK_EQ(object, core_->write_overlapped_.hEvent); |
| 237 if (core_->socket_) | 237 if (core_->socket_) |
| 238 core_->socket_->DidCompleteWrite(); | 238 core_->socket_->DidCompleteWrite(); |
| 239 | 239 |
| 240 core_->Release(); | 240 core_->Release(); |
| 241 } | 241 } |
| 242 | 242 |
| 243 //----------------------------------------------------------------------------- | 243 //----------------------------------------------------------------------------- |
| 244 | 244 |
| 245 TCPSocketWin::TCPSocketWin(net::NetLog* net_log, | 245 TCPSocketWin::TCPSocketWin( |
| 246 const net::NetLog::Source& source) | 246 scoped_ptr<SocketPerformanceWatcher> socket_performance_watcher, |
| 247 : socket_(INVALID_SOCKET), | 247 net::NetLog* net_log, |
| 248 const net::NetLog::Source& source) |
| 249 : socket_performance_watcher_(std::move(socket_performance_watcher)), |
| 250 socket_(INVALID_SOCKET), |
| 248 accept_event_(WSA_INVALID_EVENT), | 251 accept_event_(WSA_INVALID_EVENT), |
| 249 accept_socket_(NULL), | 252 accept_socket_(NULL), |
| 250 accept_address_(NULL), | 253 accept_address_(NULL), |
| 251 waiting_connect_(false), | 254 waiting_connect_(false), |
| 252 waiting_read_(false), | 255 waiting_read_(false), |
| 253 waiting_write_(false), | 256 waiting_write_(false), |
| 254 connect_os_error_(0), | 257 connect_os_error_(0), |
| 255 logging_multiple_connect_attempts_(false), | 258 logging_multiple_connect_attempts_(false), |
| 256 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_SOCKET)) { | 259 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_SOCKET)) { |
| 257 net_log_.BeginEvent(NetLog::TYPE_SOCKET_ALIVE, | 260 net_log_.BeginEvent(NetLog::TYPE_SOCKET_ALIVE, |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 | 695 |
| 693 IPEndPoint ip_end_point; | 696 IPEndPoint ip_end_point; |
| 694 if (!ip_end_point.FromSockAddr(storage.addr, storage.addr_len)) { | 697 if (!ip_end_point.FromSockAddr(storage.addr, storage.addr_len)) { |
| 695 NOTREACHED(); | 698 NOTREACHED(); |
| 696 if (closesocket(new_socket) < 0) | 699 if (closesocket(new_socket) < 0) |
| 697 PLOG(ERROR) << "closesocket"; | 700 PLOG(ERROR) << "closesocket"; |
| 698 int net_error = ERR_ADDRESS_INVALID; | 701 int net_error = ERR_ADDRESS_INVALID; |
| 699 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_TCP_ACCEPT, net_error); | 702 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_TCP_ACCEPT, net_error); |
| 700 return net_error; | 703 return net_error; |
| 701 } | 704 } |
| 702 scoped_ptr<TCPSocketWin> tcp_socket(new TCPSocketWin( | 705 scoped_ptr<TCPSocketWin> tcp_socket( |
| 703 net_log_.net_log(), net_log_.source())); | 706 new TCPSocketWin(NULL, net_log_.net_log(), net_log_.source())); |
| 704 int adopt_result = tcp_socket->AdoptConnectedSocket(new_socket, ip_end_point); | 707 int adopt_result = tcp_socket->AdoptConnectedSocket(new_socket, ip_end_point); |
| 705 if (adopt_result != OK) { | 708 if (adopt_result != OK) { |
| 706 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_TCP_ACCEPT, adopt_result); | 709 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_TCP_ACCEPT, adopt_result); |
| 707 return adopt_result; | 710 return adopt_result; |
| 708 } | 711 } |
| 709 *socket = std::move(tcp_socket); | 712 *socket = std::move(tcp_socket); |
| 710 *address = ip_end_point; | 713 *address = ip_end_point; |
| 711 net_log_.EndEvent(NetLog::TYPE_TCP_ACCEPT, | 714 net_log_.EndEvent(NetLog::TYPE_TCP_ACCEPT, |
| 712 CreateNetLogIPEndPointCallback(&ip_end_point)); | 715 CreateNetLogIPEndPointCallback(&ip_end_point)); |
| 713 return OK; | 716 return OK; |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1006 } | 1009 } |
| 1007 | 1010 |
| 1008 bool TCPSocketWin::GetEstimatedRoundTripTime(base::TimeDelta* out_rtt) const { | 1011 bool TCPSocketWin::GetEstimatedRoundTripTime(base::TimeDelta* out_rtt) const { |
| 1009 DCHECK(out_rtt); | 1012 DCHECK(out_rtt); |
| 1010 // TODO(bmcquade): Consider implementing using | 1013 // TODO(bmcquade): Consider implementing using |
| 1011 // GetPerTcpConnectionEStats/GetPerTcp6ConnectionEStats. | 1014 // GetPerTcpConnectionEStats/GetPerTcp6ConnectionEStats. |
| 1012 return false; | 1015 return false; |
| 1013 } | 1016 } |
| 1014 | 1017 |
| 1015 } // namespace net | 1018 } // namespace net |
| OLD | NEW |