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

Unified Diff: google_apis/gcm/engine/connection_factory_impl.cc

Issue 118133003: [GCM] Add heartbeat manager and reconnection logic due to heartbeat failure (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Unrevert fixes Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | google_apis/gcm/engine/connection_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/gcm/engine/connection_factory_impl.cc
diff --git a/google_apis/gcm/engine/connection_factory_impl.cc b/google_apis/gcm/engine/connection_factory_impl.cc
index d577a6857b1024d5e483b15ea640474c0eaad2b9..31c225b4d5570b57194ae812efe7d79927cdac65 100644
--- a/google_apis/gcm/engine/connection_factory_impl.cc
+++ b/google_apis/gcm/engine/connection_factory_impl.cc
@@ -117,7 +117,9 @@ void ConnectionFactoryImpl::Connect() {
}
bool ConnectionFactoryImpl::IsEndpointReachable() const {
- return connection_handler_ && connection_handler_->CanSendMessage();
+ return connection_handler_ &&
+ connection_handler_->CanSendMessage() &&
+ !connecting_;
}
void ConnectionFactoryImpl::SignalConnectionReset() {
@@ -164,6 +166,10 @@ void ConnectionFactoryImpl::OnIPAddressChanged() {
void ConnectionFactoryImpl::ConnectImpl() {
DCHECK(!IsEndpointReachable());
+ if (socket_handle_.socket() && socket_handle_.socket()->IsConnected())
+ socket_handle_.socket()->Disconnect();
+ socket_handle_.Reset();
+
// TODO(zea): resolve proxies.
net::ProxyInfo proxy_info;
proxy_info.UseDirect();
@@ -193,7 +199,7 @@ void ConnectionFactoryImpl::InitHandler() {
DCHECK(login_request.IsInitialized());
}
- connection_handler_->Init(login_request, socket_handle_.PassSocket());
+ connection_handler_->Init(login_request, socket_handle_.socket());
}
scoped_ptr<net::BackoffEntry> ConnectionFactoryImpl::CreateBackoffEntry(
« no previous file with comments | « no previous file | google_apis/gcm/engine/connection_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698