private static void fireEvent() { AsyncContext[] subscriptions; lock (eventSubscriptions) { subscriptions = new AsyncContext[eventSubscriptions.Count]; eventSubscriptions.CopyTo(subscriptions); eventSubscriptions.Clear(); } if (0 < subscriptions.Length) { var response = new EventResponse(); foreach (var elm in subscriptions) { try { elm.completeCall(response.toByteArray()); } catch (Exception e) { } } } }
private static byte[] executeAsync(IRpcClientInfo client, IntPtr asyncState, byte[] bytes) { using (client.Impersonate()) { var request = Serializer.Deserialize<EventRequest>(new MemoryStream(bytes)); var response = new EventResponse(); return response.toByteArray(); } }