| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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( |
| 73 std::unique_ptr<BlimpConnection> connection) { | 73 std::unique_ptr<BlimpConnection> connection) { |
| 74 DVLOG(1) << "Sending authentication message."; | 74 DVLOG(1) << "Sending authentication message."; |
| 75 connection->GetOutgoingMessageProcessor()->ProcessMessage( | 75 connection->GetOutgoingMessageProcessor()->ProcessMessage( |
| 76 CreateStartConnectionMessage(client_token_, kProtocolVersion), | 76 CreateStartConnectionMessage(client_auth_token_, kProtocolVersion), |
| 77 base::Bind(&ClientConnectionManager::OnAuthenticationMessageSent, | 77 base::Bind(&ClientConnectionManager::OnAuthenticationMessageSent, |
| 78 weak_factory_.GetWeakPtr(), | 78 weak_factory_.GetWeakPtr(), |
| 79 base::Passed(std::move(connection)))); | 79 base::Passed(std::move(connection)))); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void ClientConnectionManager::OnAuthenticationMessageSent( | 82 void ClientConnectionManager::OnAuthenticationMessageSent( |
| 83 std::unique_ptr<BlimpConnection> connection, | 83 std::unique_ptr<BlimpConnection> connection, |
| 84 int result) { | 84 int result) { |
| 85 DVLOG(1) << "AuthenticationMessageSent, result=" << result; | 85 DVLOG(1) << "AuthenticationMessageSent, result=" << result; |
| 86 if (result != net::OK) { | 86 if (result != net::OK) { |
| 87 // If a write error occurred, just throw away |connection|. | 87 // If a write error occurred, just throw away |connection|. |
| 88 // We don't need to propagate the error code here because the connection | 88 // We don't need to propagate the error code here because the connection |
| 89 // will already have done so via the ErrorObserver object. | 89 // will already have done so via the ErrorObserver object. |
| 90 return; | 90 return; |
| 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 |