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/client_connection_manager.h" | 5 #include "blimp/net/client_connection_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 base::Unretained(this), transport_index)); | 50 base::Unretained(this), transport_index)); |
51 } else { | 51 } else { |
52 // TODO(haibinlu): add an error reporting path out for this. | 52 // TODO(haibinlu): add an error reporting path out for this. |
53 LOG(WARNING) << "All transports failed to connect"; | 53 LOG(WARNING) << "All transports failed to connect"; |
54 } | 54 } |
55 } | 55 } |
56 | 56 |
57 void ClientConnectionManager::OnConnectResult(int transport_index, int result) { | 57 void ClientConnectionManager::OnConnectResult(int transport_index, int result) { |
58 DCHECK_NE(result, net::ERR_IO_PENDING); | 58 DCHECK_NE(result, net::ERR_IO_PENDING); |
59 const auto& transport = transports_[transport_index]; | 59 const auto& transport = transports_[transport_index]; |
| 60 DVLOG(1) << "OnConnectResult; result = " << result; |
60 if (result == net::OK) { | 61 if (result == net::OK) { |
61 std::unique_ptr<BlimpConnection> connection = | 62 std::unique_ptr<BlimpConnection> connection = transport->MakeConnection(); |
62 base::MakeUnique<BlimpConnection>(transport->TakeMessagePort()); | |
63 connection->AddConnectionErrorObserver(this); | 63 connection->AddConnectionErrorObserver(this); |
64 SendAuthenticationMessage(std::move(connection)); | 64 SendAuthenticationMessage(std::move(connection)); |
65 } else { | 65 } else { |
66 DVLOG(1) << "Transport " << transport->GetName() | 66 DVLOG(1) << "Transport " << transport->GetName() |
67 << " failed to connect:" << net::ErrorToString(result); | 67 << " failed to connect:" << net::ErrorToString(result); |
68 Connect(transport_index + 1); | 68 Connect(transport_index + 1); |
69 } | 69 } |
70 } | 70 } |
71 | 71 |
72 void ClientConnectionManager::SendAuthenticationMessage( | 72 void ClientConnectionManager::SendAuthenticationMessage( |
(...skipping 18 matching lines...) Expand all Loading... |
91 } | 91 } |
92 connection_handler_->HandleConnection(std::move(connection)); | 92 connection_handler_->HandleConnection(std::move(connection)); |
93 } | 93 } |
94 | 94 |
95 void ClientConnectionManager::OnConnectionError(int error) { | 95 void ClientConnectionManager::OnConnectionError(int error) { |
96 // TODO(kmarshall): implement reconnection logic. | 96 // TODO(kmarshall): implement reconnection logic. |
97 VLOG(0) << "Connection dropped, error=" << error; | 97 VLOG(0) << "Connection dropped, error=" << error; |
98 } | 98 } |
99 | 99 |
100 } // namespace blimp | 100 } // namespace blimp |
OLD | NEW |