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 2d459f20d2f88159ba18e8bef48e0c9084197177..1eba5809ed8c061013837e3305ddae210900dc90 100644 |
--- a/google_apis/gcm/engine/connection_factory_impl.cc |
+++ b/google_apis/gcm/engine/connection_factory_impl.cc |
@@ -209,9 +209,14 @@ void ConnectionFactoryImpl::SignalConnectionReset( |
// connection. |
} |
- if (reason == LOGIN_FAILURE) |
- event_tracker_.ConnectionLoginFailed(); |
- event_tracker_.EndConnectionAttempt(); |
+ // SignalConnectionReset can be called at any time without regard to whether |
+ // a connection attempt is currently in progress. Only notify the event |
+ // tracker if there is an event in progress. |
+ if (event_tracker_.IsEventInProgress()) { |
+ if (reason == LOGIN_FAILURE) |
+ event_tracker_.ConnectionLoginFailed(); |
+ event_tracker_.EndConnectionAttempt(); |
+ } |
CloseSocket(); |
DCHECK(!IsEndpointReachable()); |