static void DispatchSessionCompletedCallback(IAsyncResult result) { if (result.CompletedSynchronously) { return; } DispatchSessionAsyncResult thisPtr = (DispatchSessionAsyncResult)result.AsyncState; Exception completeException = null; try { thisPtr.CompleteDuplicateSession(result); } #pragma warning suppress 56500 // covered by FxCOP catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } completeException = exception; } thisPtr.Complete(false, completeException); }
internal bool EndDispatchSession(IAsyncResult result) { try { DispatchSessionAsyncResult dispatchAsyncResult = DispatchSessionAsyncResult.End(result); if (dispatchAsyncResult.DuplicateSucceeded) { OnDispatchSuccess(); return(true); } } catch (Exception exception) { EventLogEventId logEventId = EventLogEventId.MessageQueueDuplicatedSocketLeak; if (this.TransportType == TransportType.NamedPipe) { logEventId = EventLogEventId.MessageQueueDuplicatedPipeLeak; } Debug.Print("WorkerProcess.DispatchSession() failed sending duplicated socket to processId: " + this.ProcessId + " exception:" + exception); DiagnosticUtility.EventLog.LogEvent(TraceEventType.Error, (ushort)EventLogCategory.SharingService, (uint)logEventId, this.ProcessId.ToString(NumberFormatInfo.InvariantInfo), ListenerTraceUtility.CreateSourceString(this), exception.ToString()); if (Fx.IsFatal(exception)) { throw; } if (exception is FaultException && !AppSettings.FailOnConnectionDispatchFaults) { // Something went wrong with establishing a connection from the duplicated handle on the service side // The communication between SMSvcHost and the service host is still good so no need to tear down the // connection because of a single bad connecting client. return(false); } Close(); // make sure we close the connection to the SharedConnectionListener // so it knows we've unregistered it ((IChannel)connectionDuplicator).Abort(); if (!ShouldRecoverFromProxyCall(exception)) { throw; } } return(false); }
internal bool EndDispatchSession(IAsyncResult result) { try { DispatchSessionAsyncResult dispatchAsyncResult = DispatchSessionAsyncResult.End(result); if (dispatchAsyncResult.DuplicateSucceeded) { OnDispatchSuccess(); return(true); } } catch (Exception exception) { EventLogEventId logEventId = EventLogEventId.MessageQueueDuplicatedSocketLeak; if (this.TransportType == TransportType.NamedPipe) { logEventId = EventLogEventId.MessageQueueDuplicatedPipeLeak; } Debug.Print("WorkerProcess.DispatchSession() failed sending duplicated socket to processId: " + this.ProcessId + " exception:" + exception); DiagnosticUtility.EventLog.LogEvent(TraceEventType.Error, (ushort)EventLogCategory.SharingService, (uint)logEventId, this.ProcessId.ToString(NumberFormatInfo.InvariantInfo), ListenerTraceUtility.CreateSourceString(this), exception.ToString()); if (Fx.IsFatal(exception)) { throw; } Close(); // make sure we close the connection to the SharedConnectionListener // so it knows we've unregistered it ((IChannel)connectionDuplicator).Abort(); if (!ShouldRecoverFromProxyCall(exception)) { throw; } } return(false); }