| 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 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <netinet/tcp.h> | 8 #include <netinet/tcp.h> |
| 9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
| 10 | 10 |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 | 522 |
| 523 SockaddrStorage storage; | 523 SockaddrStorage storage; |
| 524 if (accept_socket_->GetPeerAddress(&storage) != OK || | 524 if (accept_socket_->GetPeerAddress(&storage) != OK || |
| 525 !address->FromSockAddr(storage.addr, storage.addr_len)) { | 525 !address->FromSockAddr(storage.addr, storage.addr_len)) { |
| 526 accept_socket_.reset(); | 526 accept_socket_.reset(); |
| 527 return ERR_ADDRESS_INVALID; | 527 return ERR_ADDRESS_INVALID; |
| 528 } | 528 } |
| 529 | 529 |
| 530 tcp_socket->reset( | 530 tcp_socket->reset( |
| 531 new TCPSocketPosix(nullptr, net_log_.net_log(), net_log_.source())); | 531 new TCPSocketPosix(nullptr, net_log_.net_log(), net_log_.source())); |
| 532 (*tcp_socket)->socket_.reset(accept_socket_.release()); | 532 (*tcp_socket)->socket_ = std::move(accept_socket_); |
| 533 return OK; | 533 return OK; |
| 534 } | 534 } |
| 535 | 535 |
| 536 void TCPSocketPosix::ConnectCompleted(const CompletionCallback& callback, | 536 void TCPSocketPosix::ConnectCompleted(const CompletionCallback& callback, |
| 537 int rv) { | 537 int rv) { |
| 538 DCHECK_NE(ERR_IO_PENDING, rv); | 538 DCHECK_NE(ERR_IO_PENDING, rv); |
| 539 callback.Run(HandleConnectCompleted(rv)); | 539 callback.Run(HandleConnectCompleted(rv)); |
| 540 } | 540 } |
| 541 | 541 |
| 542 int TCPSocketPosix::HandleConnectCompleted(int rv) { | 542 int TCPSocketPosix::HandleConnectCompleted(int rv) { |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 if (info.tcpi_rtt > 0) { | 810 if (info.tcpi_rtt > 0) { |
| 811 *out_rtt = base::TimeDelta::FromMicroseconds(info.tcpi_rtt); | 811 *out_rtt = base::TimeDelta::FromMicroseconds(info.tcpi_rtt); |
| 812 return true; | 812 return true; |
| 813 } | 813 } |
| 814 } | 814 } |
| 815 #endif // defined(TCP_INFO) | 815 #endif // defined(TCP_INFO) |
| 816 return false; | 816 return false; |
| 817 } | 817 } |
| 818 | 818 |
| 819 } // namespace net | 819 } // namespace net |
| OLD | NEW |