Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(488)

Side by Side Diff: blimp/net/client_connection_manager.cc

Issue 2439403003: Refactor BlimpConnection to TCPConnection (Closed)
Patch Set: Added missing Engine Transport Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698