diff --git a/JdSoft.Apple.Apns.Notifications/NotificationService.cs b/JdSoft.Apple.Apns.Notifications/NotificationService.cs index 6cd3844..1385e7a 100644 --- a/JdSoft.Apple.Apns.Notifications/NotificationService.cs +++ b/JdSoft.Apple.Apns.Notifications/NotificationService.cs @@ -467,11 +467,14 @@ void newCon_Connecting(object sender) private bool queueSequential(Notification notification) { - if (sequential > notificationConnections.Count - 1) - sequential = 0; - - if (notificationConnections[sequential] != null) - return notificationConnections[sequential++].QueueNotification(notification); + var index = sequential; + if (index > notificationConnections.Count - 1) + sequential = index = 0; + else + sequential++; + + if (notificationConnections[index] != null) + return notificationConnections[index].QueueNotification(notification); return false; }