Exemplo n.º 1
0
        private static bool TryEnqueueNextHopAfterTransfer(MessageTrackingLogEntry transferEvent, TrackingContext context, Queue <MailItemTracker> remainingTrackers)
        {
            ServerInfo server = ServerCache.Instance.FindMailboxOrHubServer(transferEvent.Server, 32UL);

            if (LogDataAnalyzer.ShouldSkipTracker(server, transferEvent, context))
            {
                return(false);
            }
            ILogReader logReader = RpcLogReader.GetLogReader(transferEvent.Server, context.DirectoryContext);

            if (logReader == null)
            {
                return(false);
            }
            List <MessageTrackingLogEntry> messageLog = context.Cache.GetMessageLog(RpcReason.None, logReader, TrackingLogPrefix.MSGTRK, transferEvent.MessageId, transferEvent.InternalMessageId);

            if (messageLog.Count == 0)
            {
                TraceWrapper.SearchLibraryTracer.TraceError <string, long>(0, "Could not find any events matching MessageId={0}, and InternalId={1}.", transferEvent.MessageId, transferEvent.ServerLogKeyMailItemId);
                return(false);
            }
            MailItemTracker item = new MailItemTracker(messageLog, context.Tree);

            remainingTrackers.Enqueue(item);
            return(true);
        }
Exemplo n.º 2
0
        private static bool TryEnqueueNextHopAfterHAResubmit(MessageTrackingLogEntry haResubmitEvent, TrackingContext context, Queue <MailItemTracker> remainingTrackers)
        {
            if (haResubmitEvent.Source != MessageTrackingSource.REDUNDANCY)
            {
                return(false);
            }
            ServerInfo server = ServerCache.Instance.FindMailboxOrHubServer(haResubmitEvent.Server, 32UL);

            if (LogDataAnalyzer.ShouldSkipTracker(server, haResubmitEvent, context))
            {
                return(false);
            }
            ILogReader logReader = RpcLogReader.GetLogReader(haResubmitEvent.Server, context.DirectoryContext);

            if (logReader == null)
            {
                return(false);
            }
            List <MessageTrackingLogEntry> messageLog = context.Cache.GetMessageLog(RpcReason.None, logReader, TrackingLogPrefix.MSGTRK, haResubmitEvent.MessageId, haResubmitEvent.InternalMessageId);
            List <MessageTrackingLogEntry> list       = messageLog.FindAll((MessageTrackingLogEntry entry) => entry.Source != MessageTrackingSource.REDUNDANCY);

            if (list.Count == 0)
            {
                TraceWrapper.SearchLibraryTracer.TraceError <string, long>(0, "Could not find any events following resubmission matching MessageId={0}, and InternalId={1}.", haResubmitEvent.MessageId, haResubmitEvent.InternalMessageId);
                return(false);
            }
            MailItemTracker item = new MailItemTracker(list, context.Tree);

            remainingTrackers.Enqueue(item);
            return(true);
        }
Exemplo n.º 3
0
        private List <MessageTrackingLogEntry> GetStartingMailItemEntries(string messageId, long internalId)
        {
            ILogReader logReader = RpcLogReader.GetLogReader(this.startingServer, this.context.DirectoryContext);

            if (logReader == null)
            {
                return(null);
            }
            List <MessageTrackingLogEntry> messageLog = this.cache.GetMessageLog(RpcReason.None, logReader, TrackingLogPrefix.MSGTRK, messageId, internalId);

            if (internalId == 0L && messageLog.Count > 1)
            {
                foreach (MessageTrackingLogEntry messageTrackingLogEntry in messageLog)
                {
                    if (messageTrackingLogEntry.EventId == MessageTrackingEvent.MODERATORAPPROVE || messageTrackingLogEntry.EventId == MessageTrackingEvent.MODERATORREJECT || messageTrackingLogEntry.EventId == MessageTrackingEvent.MODERATIONEXPIRE)
                    {
                        return(new List <MessageTrackingLogEntry>(1)
                        {
                            messageTrackingLogEntry
                        });
                    }
                }
                List <MessageTrackingLogEntry> list = new List <MessageTrackingLogEntry>(1);
                list.Add(messageLog.Find((MessageTrackingLogEntry entry) => entry.EventId == MessageTrackingEvent.SUBMIT));
                return(list);
            }
            return(messageLog);
        }
Exemplo n.º 4
0
        private static bool TryEnqueueNextHopAfterHARedirect(MessageTrackingLogEntry haRedirectEvent, TrackingContext context, Queue <MailItemTracker> remainingTrackers)
        {
            ServerInfo nextHopServer = haRedirectEvent.GetNextHopServer();

            if (LogDataAnalyzer.ShouldSkipTracker(nextHopServer, haRedirectEvent, context))
            {
                return(false);
            }
            ILogReader logReader = RpcLogReader.GetLogReader(haRedirectEvent.NextHopFqdnOrName, context.DirectoryContext);

            if (logReader == null)
            {
                return(false);
            }
            List <MessageTrackingLogEntry> messageLog = context.Cache.GetMessageLog(RpcReason.None, logReader, TrackingLogPrefix.MSGTRK, haRedirectEvent.MessageId, null, SearchMessageTrackingReportImpl.HAReceiveOrResubmitEventsFilterSet);

            if (messageLog.Count == 0)
            {
                TraceWrapper.SearchLibraryTracer.TraceError <MessageTrackingLogEntry, string>(0, "Could not find any HA receive events to match {0} on {1}.", haRedirectEvent, haRedirectEvent.NextHopFqdnOrName);
                return(false);
            }
            MailItemTracker item = new MailItemTracker(messageLog, context.Tree);

            remainingTrackers.Enqueue(item);
            return(true);
        }
Exemplo n.º 5
0
        private static MessageTrackingLogEntry LocateModeratorResponse(MessageTrackingLogEntry initMessageEvent, TrackingContext context, out ILogReader reader)
        {
            ServerInfo serverInfo = LogDataAnalyzer.IdentifyArbitrationMailboxServer(initMessageEvent.ArbitrationMailboxAddress, context.DirectoryContext);

            if (serverInfo.ServerSiteId.Equals(ServerCache.Instance.GetLocalServerSiteId(context.DirectoryContext)))
            {
                reader = null;
                return(null);
            }
            if (serverInfo.AdminDisplayVersion.ToInt() > Constants.E14SP1ModerationReferralSupportVersion)
            {
                IEnumerable <ServerInfo> casServers = ServerCache.Instance.GetCasServers(serverInfo.ServerSiteId);
                foreach (ServerInfo serverInfo2 in casServers)
                {
                    if (serverInfo2.AdminDisplayVersion.ToInt() > Constants.E14SP1ModerationReferralSupportVersion)
                    {
                        TraceWrapper.SearchLibraryTracer.TraceError <ADObjectId>(0, "Cas in site {0} can handle x-site moderation init message referral. Init message will be handled as a referral later.", serverInfo.ServerSiteId);
                        reader = null;
                        return(null);
                    }
                }
            }
            if (!serverInfo.IsSearchable)
            {
                TraceWrapper.SearchLibraryTracer.TraceError <string, ServerStatus>(0, "Could not search mailbox server for arbitration mailbox {0}: {1}.", serverInfo.Key, serverInfo.Status);
                reader = null;
                return(null);
            }
            reader = RpcLogReader.GetLogReader(serverInfo.Key, context.DirectoryContext);
            if (reader == null)
            {
                return(null);
            }
            List <MessageTrackingLogEntry> messageLog = context.Cache.GetMessageLog(RpcReason.None, reader, TrackingLogPrefix.MSGTRK, initMessageEvent.InitMessageId, null, LogDataAnalyzer.validModeratorResponseTypes);

            if (messageLog.Count == 0)
            {
                TraceWrapper.SearchLibraryTracer.TraceError <string, string>(0, "No moderator responses found for Initiation Message {0} on {1}", initMessageEvent.InitMessageId, serverInfo.Key);
                return(null);
            }
            return(messageLog[0]);
        }
Exemplo n.º 6
0
        private static bool TryEnqueueNextHopAfterSubmitInternal(MessageTrackingLogEntry submitEvent, TrackingContext context, Queue <MailItemTracker> remainingTrackers, bool searchAfterModerationApproval)
        {
            ServerInfo nextHopServer = submitEvent.GetNextHopServer();

            if (LogDataAnalyzer.ShouldSkipTracker(nextHopServer, submitEvent, context))
            {
                return(false);
            }
            ILogReader logReader = RpcLogReader.GetLogReader(submitEvent.NextHopFqdnOrName, context.DirectoryContext);

            if (logReader == null)
            {
                return(false);
            }
            List <MessageTrackingLogEntry> messageLog = context.Cache.GetMessageLog(RpcReason.None, logReader, TrackingLogPrefix.MSGTRK, submitEvent.MessageId, new MessageTrackingSource?((logReader.MtrSchemaVersion >= MtrSchemaVersion.E15RTM) ? MessageTrackingSource.SMTP : MessageTrackingSource.STOREDRIVER), SearchMessageTrackingReportImpl.ReceiveEventFilterSet);

            if (messageLog.Count == 0)
            {
                TraceWrapper.SearchLibraryTracer.TraceDebug <string, string, MessageTrackingLogEntry>(0, "No {0} Receive event found on {1} to match {2}.", (logReader.MtrSchemaVersion >= MtrSchemaVersion.E15RTM) ? "SMTP" : "StoreDriver", submitEvent.NextHopFqdnOrName, submitEvent);
                return(false);
            }
            long num;

            if (!searchAfterModerationApproval)
            {
                num = messageLog[0].ServerLogKeyMailItemId;
            }
            else
            {
                num = LogDataAnalyzer.GetCheckReceiveEventAfterModerationApproval(messageLog, context, logReader);
                if (num == 0L)
                {
                    return(false);
                }
            }
            foreach (MessageTrackingLogEntry messageTrackingLogEntry in messageLog)
            {
                LogDataAnalyzer.CreateAndEnqueueTracker(context, remainingTrackers, logReader, TrackingLogPrefix.MSGTRK, messageTrackingLogEntry.MessageId, num);
            }
            return(true);
        }
Exemplo n.º 7
0
        private static bool TryEnqueueNextHopAfterSend(MessageTrackingLogEntry sendEvent, TrackingContext context, Queue <MailItemTracker> remainingTrackers)
        {
            ServerInfo nextHopServer = sendEvent.GetNextHopServer();

            if (LogDataAnalyzer.ShouldSkipTracker(nextHopServer, sendEvent, context))
            {
                return(false);
            }
            ILogReader logReader = RpcLogReader.GetLogReader(sendEvent.NextHopFqdnOrName, context.DirectoryContext);

            if (logReader == null)
            {
                return(false);
            }
            MessageTrackingSource?         sourceFilter     = null;
            HashSet <MessageTrackingEvent> eventIdFilterSet = SearchMessageTrackingReportImpl.ReceiveOrDeliverEventsFilterSet;

            if (logReader.MtrSchemaVersion < MtrSchemaVersion.E15RTM)
            {
                sourceFilter     = new MessageTrackingSource?(MessageTrackingSource.SMTP);
                eventIdFilterSet = SearchMessageTrackingReportImpl.ReceiveEventFilterSet;
            }
            List <MessageTrackingLogEntry> messageLog = context.Cache.GetMessageLog(RpcReason.None, logReader, TrackingLogPrefix.MSGTRK, sendEvent.MessageId, sourceFilter, eventIdFilterSet);

            if (messageLog.Count == 0)
            {
                return(false);
            }
            foreach (MessageTrackingLogEntry messageTrackingLogEntry in messageLog)
            {
                if (LogDataAnalyzer.CheckRecipientListEquality(sendEvent, messageTrackingLogEntry))
                {
                    LogDataAnalyzer.CreateAndEnqueueTracker(context, remainingTrackers, logReader, TrackingLogPrefix.MSGTRK, messageTrackingLogEntry.MessageId, messageTrackingLogEntry.ServerLogKeyMailItemId);
                    return(true);
                }
            }
            TraceWrapper.SearchLibraryTracer.TraceError <MessageTrackingLogEntry, string>(0, "Could not find any receive events to match {0} on {1}.", sendEvent, sendEvent.NextHopFqdnOrName);
            return(false);
        }
Exemplo n.º 8
0
        private static bool TryEnqueueNextHopAfterModeratorApprove(MessageTrackingLogEntry approvalEvent, TrackingContext context, Queue <MailItemTracker> remainingTrackers)
        {
            ILogReader logReader = RpcLogReader.GetLogReader(approvalEvent.Server, context.DirectoryContext);

            if (logReader == null)
            {
                return(false);
            }
            List <MessageTrackingLogEntry> messageLog = context.Cache.GetMessageLog(RpcReason.None, logReader, TrackingLogPrefix.MSGTRK, approvalEvent.MessageId, new MessageTrackingSource?(MessageTrackingSource.STOREDRIVER), SearchMessageTrackingReportImpl.SubmitEventFilterSet);

            if (messageLog.Count == 0)
            {
                TraceWrapper.SearchLibraryTracer.TraceError <string>(0, "Moderator approval event found, but no matching submission of the message back into transport was found on mailbox server {0}.", approvalEvent.Server);
                return(false);
            }
            MessageTrackingLogEntry messageTrackingLogEntry = null;

            foreach (MessageTrackingLogEntry messageTrackingLogEntry2 in messageLog)
            {
                if (!LogDataAnalyzer.IsEntryProcessed(messageTrackingLogEntry2, context.Tree))
                {
                    messageTrackingLogEntry             = messageTrackingLogEntry2;
                    messageTrackingLogEntry.ProcessedBy = context.Tree;
                    break;
                }
            }
            if (messageTrackingLogEntry == null)
            {
                TraceWrapper.SearchLibraryTracer.TraceError(0, "All submission events found after processing moderator approval had already been processed.", new object[0]);
                return(false);
            }
            ILogReader logReader2 = RpcLogReader.GetLogReader(messageTrackingLogEntry.NextHopFqdnOrName, context.DirectoryContext);

            if (logReader2 == null)
            {
                return(false);
            }
            List <MessageTrackingLogEntry> messageLog2 = context.Cache.GetMessageLog(RpcReason.None, logReader2, TrackingLogPrefix.MSGTRK, approvalEvent.OrigMessageId, new MessageTrackingSource?(MessageTrackingSource.APPROVAL), SearchMessageTrackingReportImpl.ReceiveEventFilterSet);

            if (messageLog2.Count == 0)
            {
                TraceWrapper.SearchLibraryTracer.TraceError(0, "No Approval Received events found", new object[0]);
                return(false);
            }
            foreach (MessageTrackingLogEntry messageTrackingLogEntry3 in messageLog2)
            {
                if (!LogDataAnalyzer.IsEntryProcessed(messageTrackingLogEntry3, context.Tree) && approvalEvent.MessageId.Equals(messageTrackingLogEntry3.InitMessageId, StringComparison.Ordinal))
                {
                    if (logReader.MtrSchemaVersion >= MtrSchemaVersion.E15RTM)
                    {
                        if (!LogDataAnalyzer.TryEnqueueNextHopAfterSubmitInternal(messageTrackingLogEntry3, context, remainingTrackers, true))
                        {
                            continue;
                        }
                    }
                    else
                    {
                        List <MessageTrackingLogEntry> messageLog3 = context.Cache.GetMessageLog(RpcReason.None, logReader2, TrackingLogPrefix.MSGTRK, approvalEvent.OrigMessageId, messageTrackingLogEntry3.ServerLogKeyMailItemId);
                        if (messageLog3.Count == 0)
                        {
                            continue;
                        }
                        MailItemTracker item = new MailItemTracker(messageLog3, context.Tree);
                        remainingTrackers.Enqueue(item);
                    }
                    return(true);
                }
            }
            TraceWrapper.SearchLibraryTracer.TraceError(0, "No unprocessed Approval Received events found", new object[0]);
            return(false);
        }