public void SendCommitted(EndpointAddress sendTo) { if (sendTo != null) { CompletionParticipantProxy proxy = this.state.TryCreateCompletionParticipantProxy(sendTo); if (proxy != null) { try { if (DebugTrace.Info) { DebugTrace.Trace(TraceLevel.Info, "Sending Committed to unrecognized completion participant at {0}", Ports.TryGetAddress(proxy)); } IAsyncResult ar = proxy.BeginSendCommitted(this.politeSendComplete, proxy); if (ar.CompletedSynchronously) { this.OnSendComplete(ar, null, proxy); } } finally { proxy.Release(); } } } }
public MsgRegisterCompletionEvent(CompletionEnlistment completion, ref Register register, RequestAsyncResult result, CompletionParticipantProxy proxy) : base(completion) { this.register = register; proxy.AddRef(); this.proxy = proxy; this.result = result; }
private void PoliteSendComplete(IAsyncResult ar) { if (!ar.CompletedSynchronously) { CompletionParticipantProxy asyncState = (CompletionParticipantProxy)ar.AsyncState; this.OnSendComplete(ar, null, asyncState); } }
private void OnSendComplete(IAsyncResult ar, CompletionEnlistment completion, CompletionParticipantProxy proxy) { try { proxy.EndSendMessage(ar); } catch (WsatSendFailureException exception) { Microsoft.Transactions.Bridge.DiagnosticUtility.ExceptionUtility.TraceHandledException(exception, TraceEventType.Warning); this.state.Perf.MessageSendFailureCountPerInterval.Increment(); if (completion != null) { DebugTrace.TraceSendFailure(completion.EnlistmentId, exception); } else { DebugTrace.TraceSendFailure(exception); } } }
public void SetCompletionProxy(CompletionParticipantProxy proxy) { proxy.AddRef(); this.participantProxy = proxy; }
public void Register(Message message, Microsoft.Transactions.Wsat.Messaging.RequestAsyncResult result) { Microsoft.Transactions.Wsat.Messaging.Register register = new Microsoft.Transactions.Wsat.Messaging.Register(message, this.state.ProtocolVersion); EndpointAddress participantProtocolService = register.ParticipantProtocolService; WsatRegistrationHeader header = WsatRegistrationHeader.ReadFrom(message); if (header == null) { if (DebugTrace.Warning) { DebugTrace.Trace(TraceLevel.Warning, "Rejecting Register message with no registration header"); } this.SendFault(result, this.state.Faults.InvalidParameters); return; } switch (register.Protocol) { case ControlProtocol.Completion: { CompletionEnlistment completion = this.state.Lookup.FindEnlistment(header.TransactionId) as CompletionEnlistment; if (completion != null) { CompletionParticipantProxy proxy = this.state.TryCreateCompletionParticipantProxy(participantProtocolService); if (proxy == null) { if (DebugTrace.Warning) { DebugTrace.Trace(TraceLevel.Warning, "Rejecting Register message for completion on no completion enlistment"); } this.SendFault(result, this.state.Faults.InvalidParameters); return; } try { completion.StateMachine.Enqueue(new MsgRegisterCompletionEvent(completion, ref register, result, proxy)); return; } finally { proxy.Release(); } break; } if (DebugTrace.Warning) { DebugTrace.Trace(TraceLevel.Warning, "Rejecting uncorrelated Register message for completion"); } this.SendFault(result, this.state.Faults.UnknownCompletionEnlistment); return; } case ControlProtocol.Volatile2PC: case ControlProtocol.Durable2PC: break; default: goto Label_0222; } if (!this.state.TransactionManager.Settings.NetworkOutboundAccess) { if (DebugTrace.Warning) { DebugTrace.Trace(TraceLevel.Warning, "Rejecting Register message because outbound transactions are disabled"); } this.SendFault(result, this.state.Faults.ParticipantRegistrationNetAccessDisabled); return; } if (register.Loopback == this.state.ProcessId) { if (DebugTrace.Warning) { DebugTrace.Trace(TraceLevel.Warning, "Rejecting recursive Register message from self"); } this.SendFault(result, this.state.Faults.ParticipantRegistrationLoopback); return; } TwoPhaseCommitParticipantProxy proxy2 = this.state.TryCreateTwoPhaseCommitParticipantProxy(participantProtocolService); if (proxy2 == null) { if (DebugTrace.Warning) { DebugTrace.Trace(TraceLevel.Warning, "Rejecting Register message because 2PC proxy could not be created"); } this.SendFault(result, this.state.Faults.InvalidParameters); return; } try { ParticipantEnlistment participant = new ParticipantEnlistment(this.state, header, register.Protocol, proxy2); this.state.TransactionManagerSend.Register(participant, new MsgRegisterEvent(participant, ref register, result)); return; } finally { proxy2.Release(); } Label_0222: Microsoft.Transactions.Bridge.DiagnosticUtility.FailFast("Registration protocol should have been validated"); }