Chromium Code Reviews| Index: blimp/net/client_connection_manager.cc |
| diff --git a/blimp/net/client_connection_manager.cc b/blimp/net/client_connection_manager.cc |
| index c8238e4ba70f318330567a20753566e81ba04e20..2ce6938d5c9f47ed765e3d7ddbccf4a9e1a1cb84 100644 |
| --- a/blimp/net/client_connection_manager.cc |
| +++ b/blimp/net/client_connection_manager.cc |
| @@ -5,7 +5,11 @@ |
| #include "blimp/net/client_connection_manager.h" |
| #include "base/logging.h" |
| +#include "blimp/common/create_blimp_message.h" |
| +#include "blimp/common/proto/blimp_message.pb.h" |
| +#include "blimp/common/protocol_version.h" |
| #include "blimp/net/blimp_connection.h" |
| +#include "blimp/net/blimp_message_processor.h" |
| #include "blimp/net/blimp_transport.h" |
| #include "blimp/net/connection_handler.h" |
| #include "net/base/net_errors.h" |
| @@ -48,7 +52,9 @@ void ClientConnectionManager::OnConnectResult(int transport_index, int result) { |
| DCHECK_NE(result, net::ERR_IO_PENDING); |
| const auto& transport = transports_[transport_index]; |
| if (result == net::OK) { |
| - connection_handler_->HandleConnection(transport->TakeConnection()); |
| + scoped_ptr<BlimpConnection> connection = transport->TakeConnection(); |
| + SendAuthenticationMessage(connection.get()); |
| + connection_handler_->HandleConnection(std::move(connection)); |
| } else { |
| DVLOG(1) << "Transport " << transport->GetName() |
| << " failed to connect:" << net::ErrorToString(result); |
| @@ -56,4 +62,13 @@ void ClientConnectionManager::OnConnectResult(int transport_index, int result) { |
| } |
| } |
| +void ClientConnectionManager::SendAuthenticationMessage( |
| + BlimpConnection* connection) { |
| + // TODO(haibinlu): get client token. |
| + const char* client_token = "token"; |
|
Wez
2015/12/09 02:30:03
Sorry, I missed that this was the production code
haibinlu
2015/12/09 19:40:34
Done.
|
| + connection->GetOutgoingMessageProcessor()->ProcessMessage( |
| + CreateStartConnectionMessage(client_token, kProtocolVersion), |
| + net::CompletionCallback()); |
| +} |
| + |
| } // namespace blimp |