diff --git a/ActiveSync/SOGoActiveSyncDispatcher+Sync.m b/ActiveSync/SOGoActiveSyncDispatcher+Sync.m index b2bac888a..59eb7de1a 100644 --- a/ActiveSync/SOGoActiveSyncDispatcher+Sync.m +++ b/ActiveSync/SOGoActiveSyncDispatcher+Sync.m @@ -2355,8 +2355,16 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. } else { + int t; + [self logWithFormat: @"Sleeping %d seconds while detecting changes in Sync...", internalInterval-total_sleep]; - sleep(sleepInterval); + + for (t = 0; t < sleepInterval; t++) + { + if ([self easShouldTerminate]) + break; + sleep(1); + } total_sleep += sleepInterval; } } diff --git a/ActiveSync/SOGoActiveSyncDispatcher.m b/ActiveSync/SOGoActiveSyncDispatcher.m index 19ba99396..512e7a99e 100644 --- a/ActiveSync/SOGoActiveSyncDispatcher.m +++ b/ActiveSync/SOGoActiveSyncDispatcher.m @@ -2242,7 +2242,7 @@ void handle_eas_terminate(int signum) defaults = [SOGoSystemDefaults sharedSystemDefaults]; defaultInterval = [defaults maximumPingInterval]; internalInterval = [defaults internalSyncInterval]; - sleepInterval = (internalInterval < 5) ? internalInterval : 5; + sleepInterval = (internalInterval < 5) ? 5 : internalInterval; if (theDocumentElement) heartbeatInterval = [[[(id)[theDocumentElement getElementsByTagName: @"HeartbeatInterval"] lastObject] textValue] intValue]; @@ -2383,8 +2383,16 @@ void handle_eas_terminate(int signum) } else { + int t; + [self logWithFormat: @"Sleeping %d seconds while detecting changes in Ping...", internalInterval-total_sleep]; - sleep(sleepInterval); + + for (t = 0; t < sleepInterval; t++) + { + if (easShouldTerminate) + break; + sleep(1); + } total_sleep += sleepInterval; } }