Chromium Code Reviews| Index: blimp/net/browser_connection_handler.cc |
| diff --git a/blimp/net/browser_connection_handler.cc b/blimp/net/browser_connection_handler.cc |
| index baa63c36ce5851fcedf454413380b4db6b03b39f..7f8edcf9dd52e11a8e22017291006396db848bca 100644 |
| --- a/blimp/net/browser_connection_handler.cc |
| +++ b/blimp/net/browser_connection_handler.cc |
| @@ -38,31 +38,26 @@ scoped_ptr<BlimpMessageProcessor> BrowserConnectionHandler::RegisterFeature( |
| void BrowserConnectionHandler::HandleConnection( |
| scoped_ptr<BlimpConnection> connection) { |
| - // Since there is only a single Client, assume a newer connection should |
| - // replace an existing one. |
| - DropCurrentConnection(); |
| + VLOG(1) << "HandleConnection " << connection; |
| + |
| + if (connection_) { |
| + // We will be clobbering |connection_| intentionally, so squelch any |
| + // socket errors that might arise. |
| + connection_->SetConnectionErrorObserver(nullptr); |
|
haibinlu
2015/12/29 00:51:45
why remove "connection_->SetIncomingMessageProcess
Kevin M
2015/12/30 23:08:49
Both are redundant. Deleting |connection_| renders
|
| + } |
| connection_ = std::move(connection); |
| - connection_->SetConnectionErrorObserver(this); |
| // Connect the incoming & outgoing message streams. |
| + connection_->SetConnectionErrorObserver(this); |
|
haibinlu
2015/12/29 00:51:45
move this up or update the comment above.
Kevin M
2015/12/30 23:08:49
Done.
|
| connection_->SetIncomingMessageProcessor(demultiplexer_.get()); |
| output_buffer_->SetOutputProcessor( |
| connection_->GetOutgoingMessageProcessor()); |
| } |
| -void BrowserConnectionHandler::DropCurrentConnection() { |
| - if (!connection_) |
| - return; |
| - |
| - connection_->SetConnectionErrorObserver(nullptr); |
| - connection_->SetIncomingMessageProcessor(nullptr); |
| - output_buffer_->SetOutputProcessor(nullptr); |
| - connection_.reset(); |
| -} |
| - |
| void BrowserConnectionHandler::OnConnectionError(int error) { |
| - LOG(WARNING) << "Connection error " << net::ErrorToString(error); |
| - DropCurrentConnection(); |
| + VLOG(1) << "OnConnectionError: " << net::ErrorToString(error); |
| + connection_.reset(); |
| + output_buffer_->SetOutputProcessor(nullptr); |
| } |
| } // namespace blimp |