From 94806ad0b317b56a42c527cba27add0842c8e480 Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 11 Mar 2016 16:29:49 -0500 Subject: [PATCH] try subscriptions right after initial download --- AddressBook.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/AddressBook.cpp b/AddressBook.cpp index aade32ee..3b3f85b4 100644 --- a/AddressBook.cpp +++ b/AddressBook.cpp @@ -340,15 +340,18 @@ namespace client void AddressBook::DownloadComplete (bool success) { m_IsDownloading = false; - if (success && m_DefaultSubscription) + int nextUpdateTimeout = CONTINIOUS_SUBSCRIPTION_RETRY_TIMEOUT; + if (success) { - m_DefaultSubscription.reset (nullptr); - m_IsLoaded = true; + if (m_DefaultSubscription) m_DefaultSubscription.reset (nullptr); + if (m_IsLoaded) + nextUpdateTimeout = CONTINIOUS_SUBSCRIPTION_UPDATE_TIMEOUT; + else + m_IsLoaded = true; } if (m_SubscriptionsUpdateTimer) { - m_SubscriptionsUpdateTimer->expires_from_now (boost::posix_time::minutes( - success ? CONTINIOUS_SUBSCRIPTION_UPDATE_TIMEOUT : CONTINIOUS_SUBSCRIPTION_RETRY_TIMEOUT)); + m_SubscriptionsUpdateTimer->expires_from_now (boost::posix_time::minutes(nextUpdateTimeout)); m_SubscriptionsUpdateTimer->async_wait (std::bind (&AddressBook::HandleSubscriptionsUpdateTimer, this, std::placeholders::_1)); }