| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 | 277 |
| 278 if (!SetNonBlockingAndGetError(socket_, &os_error)) { | 278 if (!SetNonBlockingAndGetError(socket_, &os_error)) { |
| 279 int result = MapSystemError(os_error); | 279 int result = MapSystemError(os_error); |
| 280 Close(); | 280 Close(); |
| 281 return result; | 281 return result; |
| 282 } | 282 } |
| 283 | 283 |
| 284 return OK; | 284 return OK; |
| 285 } | 285 } |
| 286 | 286 |
| 287 int TCPSocketWin::AdoptConnectedSocket(SOCKET socket, | 287 int TCPSocketWin::AdoptConnectedSocket(SocketDescriptor socket, |
| 288 const IPEndPoint& peer_address) { | 288 const IPEndPoint& peer_address) { |
| 289 DCHECK(CalledOnValidThread()); | 289 DCHECK(CalledOnValidThread()); |
| 290 DCHECK_EQ(socket_, INVALID_SOCKET); | 290 DCHECK_EQ(socket_, INVALID_SOCKET); |
| 291 DCHECK(!core_.get()); | 291 DCHECK(!core_.get()); |
| 292 | 292 |
| 293 socket_ = socket; | 293 socket_ = socket; |
| 294 | 294 |
| 295 int os_error; | 295 int os_error; |
| 296 if (!SetNonBlockingAndGetError(socket_, &os_error)) { | 296 if (!SetNonBlockingAndGetError(socket_, &os_error)) { |
| 297 int result = MapSystemError(os_error); | 297 int result = MapSystemError(os_error); |
| 298 Close(); | 298 Close(); |
| 299 return result; | 299 return result; |
| 300 } | 300 } |
| 301 | 301 |
| 302 core_ = new Core(this); | 302 core_ = new Core(this); |
| 303 peer_address_.reset(new IPEndPoint(peer_address)); | 303 peer_address_.reset(new IPEndPoint(peer_address)); |
| 304 | 304 |
| 305 return OK; | 305 return OK; |
| 306 } | 306 } |
| 307 | 307 |
| 308 int TCPSocketWin::AdoptListenSocket(SOCKET socket) { | 308 int TCPSocketWin::AdoptUnconnectedSocket(SocketDescriptor socket) { |
| 309 DCHECK(CalledOnValidThread()); | 309 DCHECK(CalledOnValidThread()); |
| 310 DCHECK_EQ(socket_, INVALID_SOCKET); | 310 DCHECK_EQ(socket_, INVALID_SOCKET); |
| 311 | 311 |
| 312 socket_ = socket; | 312 socket_ = socket; |
| 313 | 313 |
| 314 int os_error; | 314 int os_error; |
| 315 if (!SetNonBlockingAndGetError(socket_, &os_error)) { | 315 if (!SetNonBlockingAndGetError(socket_, &os_error)) { |
| 316 int result = MapSystemError(os_error); | 316 int result = MapSystemError(os_error); |
| 317 Close(); | 317 Close(); |
| 318 return result; | 318 return result; |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1036 } | 1036 } |
| 1037 | 1037 |
| 1038 bool TCPSocketWin::GetEstimatedRoundTripTime(base::TimeDelta* out_rtt) const { | 1038 bool TCPSocketWin::GetEstimatedRoundTripTime(base::TimeDelta* out_rtt) const { |
| 1039 DCHECK(out_rtt); | 1039 DCHECK(out_rtt); |
| 1040 // TODO(bmcquade): Consider implementing using | 1040 // TODO(bmcquade): Consider implementing using |
| 1041 // GetPerTcpConnectionEStats/GetPerTcp6ConnectionEStats. | 1041 // GetPerTcpConnectionEStats/GetPerTcp6ConnectionEStats. |
| 1042 return false; | 1042 return false; |
| 1043 } | 1043 } |
| 1044 | 1044 |
| 1045 } // namespace net | 1045 } // namespace net |
| OLD | NEW |