Index: google_apis/gcm/engine/connection_factory_impl.h |
diff --git a/google_apis/gcm/engine/connection_factory_impl.h b/google_apis/gcm/engine/connection_factory_impl.h |
index 967c6c1ae46d0fc820ca02e51a82f4f8b4a297bb..28c29414de3be48ff7de2a5ff6e7ae19ed2d9373 100644 |
--- a/google_apis/gcm/engine/connection_factory_impl.h |
+++ b/google_apis/gcm/engine/connection_factory_impl.h |
@@ -32,7 +32,7 @@ class GCM_EXPORT ConnectionFactoryImpl : |
public net::NetworkChangeNotifier::IPAddressObserver { |
public: |
ConnectionFactoryImpl( |
- const GURL& mcs_endpoint, |
+ const std::vector<GURL>& mcs_endpoints, |
const net::BackoffEntry::Policy& backoff_policy, |
scoped_refptr<net::HttpNetworkSession> network_session, |
net::NetLog* net_log); |
@@ -54,6 +54,11 @@ class GCM_EXPORT ConnectionFactoryImpl : |
net::NetworkChangeNotifier::ConnectionType type) OVERRIDE; |
virtual void OnIPAddressChanged() OVERRIDE; |
+ // Returns the server to which the factory is currently connected, or if |
+ // a connection is currently pending, the server to which the next connection |
+ // attempt will be made. |
+ GURL GetCurrentEndpoint() const; |
+ |
protected: |
// Implementation of Connect(..). If not in backoff, uses |login_request_| |
// in attempting a connection/handshake. On connection/handshake failure, goes |
@@ -89,8 +94,12 @@ class GCM_EXPORT ConnectionFactoryImpl : |
void CloseSocket(); |
- // The MCS endpoint to make connections to. |
- const GURL mcs_endpoint_; |
+ // The MCS endpoints to make connections to, sorted in order of priority. |
+ const std::vector<GURL> mcs_endpoints_; |
+ // Index to the endpoint for which a connection should be attempted next. |
+ size_t next_endpoint_; |
+ // Index to the endpoint that was last successfully connected. |
+ size_t last_successful_endpoint_; |
// The backoff policy to use. |
const net::BackoffEntry::Policy backoff_policy_; |