Exemple #1
0
        public void Fault(Message message, MessageFault fault)
        {
            CoordinatorEnlistment         enlistment;
            VolatileCoordinatorEnlistment enlistment2;

            if (this.CheckMessage(message, false, out enlistment, out enlistment2))
            {
                if (enlistment != null)
                {
                    enlistment.StateMachine.Enqueue(new MsgDurableCoordinatorFaultEvent(enlistment, fault));
                }
                else if (enlistment2 != null)
                {
                    enlistment2.StateMachine.Enqueue(new MsgVolatileCoordinatorFaultEvent(enlistment2, fault));
                }
                else if (DebugTrace.Info)
                {
                    DebugTrace.Trace(TraceLevel.Info, "Ignoring {0} fault from unrecognized coordinator at {1}: {2}", Library.GetFaultCodeName(fault), Ports.TryGetFromAddress(message), Library.GetFaultCodeReason(fault));
                }
                this.state.Perf.FaultsReceivedCountPerInterval.Increment();
            }
        }
 public void Fault(Message message, MessageFault fault)
 {
     if (this.CheckMessage(message, false) != null)
     {
         this.state.Perf.FaultsReceivedCountPerInterval.Increment();
     }
     if (DebugTrace.Info)
     {
         DebugTrace.Trace(TraceLevel.Info, "Ignoring {0} fault from completion participant at {1}: {2}", Library.GetFaultCodeName(fault), Ports.TryGetFromAddress(message), Library.GetFaultCodeReason(fault));
     }
 }
        private ParticipantEnlistment CheckMessage(Message message, bool fault, bool preparedOrReplay)
        {
            Guid            guid;
            ControlProtocol protocol;

            if (!Ports.TryGetEnlistment(message, out guid, out protocol))
            {
                DebugTrace.Trace(TraceLevel.Warning, "Could not read enlistment header from message");
                if (fault)
                {
                    this.SendFault(message, this.state.Faults.InvalidParameters);
                }
                return(null);
            }
            Microsoft.Transactions.Wsat.Protocol.TransactionEnlistment enlistment = this.state.Lookup.FindEnlistment(guid);
            if (enlistment == null)
            {
                DebugTrace.Trace(TraceLevel.Verbose, "Enlistment {0} could not be found", guid);
                if (preparedOrReplay)
                {
                    if (protocol == ControlProtocol.Volatile2PC)
                    {
                        if (DebugTrace.Warning)
                        {
                            DebugTrace.Trace(TraceLevel.Warning, "Received Prepared or Replay from unrecognized volatile participant at {0}", Ports.TryGetFromAddress(message));
                        }
                        if (VolatileParticipantInDoubtRecord.ShouldTrace)
                        {
                            VolatileParticipantInDoubtRecord.Trace(guid, Library.GetReplyToHeader(message.Headers), this.state.ProtocolVersion);
                        }
                        this.SendFault(message, this.state.Faults.UnknownTransaction);
                    }
                    else if (protocol == ControlProtocol.Durable2PC)
                    {
                        this.SendRollback(message);
                    }
                    else
                    {
                        this.SendFault(message, this.state.Faults.InvalidParameters);
                    }
                }
                else if (DebugTrace.Info)
                {
                    DebugTrace.Trace(TraceLevel.Info, "Ignoring message from unrecognized participant at {0}", Ports.TryGetFromAddress(message));
                }
                return(null);
            }
            ParticipantEnlistment enlistment2 = enlistment as ParticipantEnlistment;

            if ((enlistment2 == null) || (protocol != enlistment2.ControlProtocol))
            {
                DebugTrace.Trace(TraceLevel.Warning, "Enlistment state does not match message for {0}", guid);
                if (fault)
                {
                    this.SendFault(message, this.state.Faults.InvalidParameters);
                }
                return(null);
            }
            if (enlistment2.ParticipantProxy == null)
            {
                DebugTrace.TxTrace(TraceLevel.Warning, enlistment2.EnlistmentId, "Participant enlistment was not correctly recovered");
                if (fault)
                {
                    this.SendFault(message, this.state.Faults.InvalidPolicy);
                }
                return(null);
            }
            if (this.state.Service.Security.CheckIdentity(enlistment2.ParticipantProxy, message))
            {
                return(enlistment2);
            }
            if (EnlistmentIdentityCheckFailedRecord.ShouldTrace)
            {
                EnlistmentIdentityCheckFailedRecord.Trace(enlistment2.EnlistmentId);
            }
            return(null);
        }