Exemplo n.º 1
0
        bool EnsureNotDuplicate()
        {
            bool isDuplicate = this.discoveryServiceImpl.IsDuplicate(OperationContext.Current.IncomingMessageHeaders.MessageId);

            if (isDuplicate && TD.DuplicateDiscoveryMessageIsEnabled())
            {
                TD.DuplicateDiscoveryMessage(
                    this.context.EventTraceActivity,
                    ProtocolStrings.TracingStrings.Resolve,
                    OperationContext.Current.IncomingMessageHeaders.MessageId.ToString());
            }

            return(!isDuplicate);
        }
Exemplo n.º 2
0
        bool IsInvalid(TMessage message)
        {
            UniqueId messageId = OperationContext.Current.IncomingMessageHeaders.MessageId;

            if (messageId == null)
            {
                if (TD.DiscoveryMessageWithNullMessageIdIsEnabled())
                {
                    TD.DiscoveryMessageWithNullMessageId(null, ProtocolStrings.TracingStrings.Bye);
                }

                return(true);
            }

            EventTraceActivity eventTraceActivity = null;

            if (Fx.Trace.IsEtwProviderEnabled)
            {
                eventTraceActivity = EventTraceActivityHelper.TryExtractActivity(OperationContext.Current.IncomingMessage);
            }

            if (this.announcementServiceImpl.IsDuplicate(messageId))
            {
                if (TD.DuplicateDiscoveryMessageIsEnabled())
                {
                    TD.DuplicateDiscoveryMessage(eventTraceActivity, ProtocolStrings.TracingStrings.Bye, messageId.ToString());
                }

                return(true);
            }
            else if (this.ValidateContent(message))
            {
                return(false);
            }
            else
            {
                if (TD.DiscoveryMessageWithInvalidContentIsEnabled())
                {
                    TD.DiscoveryMessageWithInvalidContent(eventTraceActivity, ProtocolStrings.TracingStrings.Bye, messageId.ToString());
                }

                return(true);
            }
        }