diff --git a/ActiveSync/SOGoActiveSyncDispatcher+Sync.m b/ActiveSync/SOGoActiveSyncDispatcher+Sync.m index a8f44d2c5..1dd8b6713 100644 --- a/ActiveSync/SOGoActiveSyncDispatcher+Sync.m +++ b/ActiveSync/SOGoActiveSyncDispatcher+Sync.m @@ -2393,8 +2393,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 565c6ad3a..07213f209 100644 --- a/ActiveSync/SOGoActiveSyncDispatcher.m +++ b/ActiveSync/SOGoActiveSyncDispatcher.m @@ -2236,7 +2236,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]; @@ -2377,8 +2377,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; } }