예제 #1
0
 private void OnAsyncRead(IAsyncResult ar)
 {
     try
     {
         if (channel.apnsStream.EndRead(ar) == 6 && readBuffer[0] == 8)
         {
             DeliveryErrorType error = (DeliveryErrorType)readBuffer[1];
             faulted = true;
             int          index = IPAddress.NetworkToHostOrder(BitConverter.ToInt32(readBuffer, 2));
             Notification faultedNotification = notifications[index];
             errors.Add(new NotificationDeliveryError(error, faultedNotification));
             current = index + 1;
             channel.ForceReconnect();
         }
     }
     catch (ObjectDisposedException)
     {
         // This is how we "cancel" the asynchronous read, so just make sure
         // the channel must reconnect to try again.
         channel.ForceReconnect();
     }
     catch (Exception x)
     {
         faulted = true;
         Console.WriteLine(x.Message);
     }
     mre.Set();
 }
		public NotificationDeliveryError(DeliveryErrorType type, Notification notification)
		{
			this.ErrorType = type;
			this.Notification = notification;
		}
 public NotificationDeliveryError(DeliveryErrorType type, Notification notification)
 {
     this.ErrorType    = type;
     this.Notification = notification;
 }