| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "blimp/net/tcp_engine_transport.h" | 5 #include "blimp/net/tcp_engine_transport.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 DCHECK(connect_callback_.is_null()); | 60 DCHECK(connect_callback_.is_null()); |
| 61 DCHECK(accepted_socket_); | 61 DCHECK(accepted_socket_); |
| 62 return base::WrapUnique( | 62 return base::WrapUnique( |
| 63 new StreamSocketConnection(std::move(accepted_socket_))); | 63 new StreamSocketConnection(std::move(accepted_socket_))); |
| 64 } | 64 } |
| 65 | 65 |
| 66 const char* TCPEngineTransport::GetName() const { | 66 const char* TCPEngineTransport::GetName() const { |
| 67 return "TCP"; | 67 return "TCP"; |
| 68 } | 68 } |
| 69 | 69 |
| 70 int TCPEngineTransport::GetLocalAddressForTesting( | 70 int TCPEngineTransport::GetLocalAddress(net::IPEndPoint* address) const { |
| 71 net::IPEndPoint* address) const { | |
| 72 DCHECK(server_socket_); | 71 DCHECK(server_socket_); |
| 73 return server_socket_->GetLocalAddress(address); | 72 return server_socket_->GetLocalAddress(address); |
| 74 } | 73 } |
| 75 | 74 |
| 76 void TCPEngineTransport::OnTCPConnectAccepted(int result) { | 75 void TCPEngineTransport::OnTCPConnectAccepted(int result) { |
| 77 DCHECK_NE(net::ERR_IO_PENDING, result); | 76 DCHECK_NE(net::ERR_IO_PENDING, result); |
| 78 DCHECK(accepted_socket_); | 77 DCHECK(accepted_socket_); |
| 79 if (result != net::OK) { | 78 if (result != net::OK) { |
| 80 accepted_socket_.reset(); | 79 accepted_socket_.reset(); |
| 81 } | 80 } |
| 82 base::ResetAndReturn(&connect_callback_).Run(result); | 81 base::ResetAndReturn(&connect_callback_).Run(result); |
| 83 } | 82 } |
| 84 | 83 |
| 85 } // namespace blimp | 84 } // namespace blimp |
| OLD | NEW |