private static void EndSmtpLatencyTracking(LatencyTracker latencyTracker) { if (Components.Configuration.ProcessTransportRole == ProcessTransportRole.MailboxSubmission) { LatencyTracker.EndTrackLatency(LatencyComponent.MailboxTransportSubmissionStoreDriverSubmissionSmtp, LatencyComponent.SmtpSend, latencyTracker); } }
// Token: 0x06000024 RID: 36 RVA: 0x000030E0 File Offset: 0x000012E0 public void HandleEvent(MapiEvent mapiEvent, MailboxSession itemStore, StoreObject item) { MailboxTransportSubmissionAssistant.IdentifyProbeMessage(mapiEvent); Thread currentThread = Thread.CurrentThread; try { Interlocked.Increment(ref this.concurrentEvents); this.SubmissionsInProgress[currentThread] = new SubmissionsInProgress.Entry(ExDateTime.UtcNow, this.databaseInfo.Guid, mapiEvent); using (new SenderGuidTraceFilter(this.databaseInfo.Guid, mapiEvent.MailboxGuid)) { bool flag = true; MailboxTransportSubmissionAssistant.LatencyRecord latencyRecord; LatencyTracker latencyTracker; if (MailboxTransportSubmissionAssistant.eventCounterToLatencyMap.TryGetValue(mapiEvent.EventCounter, out latencyRecord)) { MailboxTransportSubmissionAssistant.eventCounterToLatencyMap.Remove(mapiEvent.EventCounter); latencyTracker = latencyRecord.LatencyTracker; LatencyTracker.EndTrackLatency(latencyRecord.LatencyComponent, latencyTracker, true); flag = false; } else { latencyTracker = LatencyTracker.CreateInstance(LatencyComponent.MailboxTransportSubmissionService); LatencyTracker.TrackPreProcessLatency(LatencyComponent.SubmissionAssistant, latencyTracker, mapiEvent.CreateTime); } LatencyTracker.BeginTrackLatency(LatencyComponent.MailboxTransportSubmissionService, latencyTracker); string text = this.FormatMapiEventInfo(mapiEvent); this.LogMapiEventIntoCrimsonChannelPeriodically(text); this.SubmissionsInProgress[Thread.CurrentThread].LatencyTracker = latencyTracker; if (MailboxTransportSubmissionAssistant.ShouldLogNotifyEvents && (flag || MailboxTransportSubmissionAssistant.ShouldLogTemporaryFailures)) { LatencyFormatter latencyFormatter = new LatencyFormatter(latencyTracker, Components.Configuration.LocalServer.TransportServer.Fqdn, mapiEvent.CreateTime, mapiEvent.CreateTime, true, false, false); MsgTrackMapiSubmitInfo msgTrackInfo = new MsgTrackMapiSubmitInfo(text, null, string.Empty, StoreDriverSubmission.LocalIPAddress, Components.Configuration.LocalServer.TransportServer.Name, string.Empty, string.Empty, MailboxTransportSubmissionAssistant.ItemEntryId(mapiEvent), latencyFormatter.FormatAndUpdatePerfCounters(), null, false, true); MessageTrackingLog.TrackNotify(msgTrackInfo, false); } MSExchangeSubmission.PendingSubmissions.Increment(); new HashSet <string>(); DateTime createTime = mapiEvent.CreateTime; MailboxTransportSubmissionService.StoreDriverTracer.ServiceTracer.TracePfdPass <int, Guid, long>(MailboxTransportSubmissionService.StoreDriverTracer.MessageProbeActivityId, (long)this.GetHashCode(), "PFD EMS {0} SubmitMail for mailbox {1} at entry {2}", 22427, mapiEvent.MailboxGuid, mapiEvent.EventCounter); LatencyFormatter latencyFormatter2 = new LatencyFormatter(latencyTracker, Components.Configuration.LocalServer.TransportServer.Fqdn, createTime, createTime, false, true, false); bool isPublicFolder = mapiEvent.ExtendedEventFlags.HasFlag(MapiExtendedEventFlags.PublicFolderMailbox); LatencyTracker.BeginTrackLatency(LatencyComponent.MailboxTransportSubmissionStoreDriverSubmission, latencyTracker); ISubmissionProvider submissionProvider = (ISubmissionProvider)Components.StoreDriverSubmission; MailSubmissionResult mailSubmissionResult = submissionProvider.SubmitMessage(Components.Configuration.LocalServer.TransportServer.ExchangeLegacyDN, mapiEvent.MailboxGuid, this.databaseInfo.Guid, this.databaseInfo.DatabaseName, mapiEvent.EventCounter, mapiEvent.ItemEntryId, mapiEvent.ParentEntryId, Components.Configuration.LocalServer.TransportServer.Fqdn, new IPAddress(StoreDriverSubmission.LocalIPAddress.GetAddressBytes()), mapiEvent.CreateTime, isPublicFolder, (mapiEvent.TenantHint == null) ? null : TenantPartitionHint.FromPersistablePartitionHint(mapiEvent.TenantHint), latencyFormatter2.FormatAndUpdatePerfCounters(), MailboxTransportSubmissionService.QuarantineHandler, MailboxTransportSubmissionService.SubmissionPoisonHandler, latencyTracker); MailSubmissionResult result = mailSubmissionResult; LatencyTracker.EndTrackLatency(LatencyComponent.MailboxTransportSubmissionStoreDriverSubmission, latencyTracker); LatencyTracker.EndTrackLatency(LatencyComponent.MailboxTransportSubmissionService, latencyTracker); this.LogAndUpdateCounters(mapiEvent, latencyTracker, createTime, result); this.HandleEventError(mapiEvent, result, latencyTracker, text); } } finally { MSExchangeSubmission.PendingSubmissions.Decrement(); Interlocked.Decrement(ref this.concurrentEvents); this.SubmissionsInProgress.Remove(currentThread); } }
private void OpenStore() { if (this.mapiSubmissionInfo.IsPublicFolder) { base.StoreDriverTracer.StoreDriverSubmissionTracer.TracePfdPass <int, string>(base.StoreDriverTracer.MessageProbeActivityId, 0L, "PFD ESD {0} Opening public store on {1}", 29595, this.mapiSubmissionInfo.MailboxServerDN); try { if (base.Context != null) { LatencyTracker.BeginTrackLatency(LatencyComponent.MailboxTransportSubmissionStoreDriverSubmissionStoreOpenSession, base.Context.LatencyTracker); } base.Session = StoreProvider.OpenStore(this.mapiSubmissionInfo.GetOrganizationId(), this.mapiSubmissionInfo.MailboxGuid); return; } finally { if (base.Context != null) { TimeSpan additionalLatency = LatencyTracker.EndTrackLatency(LatencyComponent.MailboxTransportSubmissionStoreDriverSubmissionStoreOpenSession, base.Context.LatencyTracker); base.Context.AddRpcLatency(additionalLatency, "Open session"); } } } base.StoreDriverTracer.StoreDriverSubmissionTracer.TracePfdPass(base.StoreDriverTracer.MessageProbeActivityId, 0L, "PFD ESD {0} Opening mailbox {1} on {2},{3}", new object[] { 17307, this.mapiSubmissionInfo.MailboxGuid, this.mapiSubmissionInfo.MdbGuid, this.mapiSubmissionInfo.MailboxFqdn }); ExDateTime dt = (base.Context == null) ? default(ExDateTime) : ExDateTime.UtcNow; try { base.Session = StoreProvider.OpenStore(this.mapiSubmissionInfo.GetOrganizationId(), "DummyName", this.mapiSubmissionInfo.MailboxFqdn, this.mapiSubmissionInfo.MailboxServerDN, this.mapiSubmissionInfo.MailboxGuid, this.mapiSubmissionInfo.MdbGuid, this.mapiSubmissionInfo.GetSenderLocales(), this.mapiSubmissionInfo.GetAggregatedMailboxGuids()); } finally { if (base.Context != null) { TimeSpan additionalLatency2 = ExDateTime.UtcNow - dt; base.Context.AddRpcLatency(additionalLatency2, "Open session"); } } base.SetSessionTimeZone(); }
protected override void Dispose(bool disposing) { try { if (disposing) { base.DisposeMessageItem(); if (base.Session != null) { if (base.Context != null) { LatencyTracker.BeginTrackLatency(LatencyComponent.MailboxTransportSubmissionStoreDriverSubmissionStoreDisposeSession, base.Context.LatencyTracker); } try { base.DisposeStoreSession(); } finally { if (base.Context != null) { TimeSpan additionalLatency = LatencyTracker.EndTrackLatency(LatencyComponent.MailboxTransportSubmissionStoreDriverSubmissionStoreDisposeSession, base.Context.LatencyTracker); base.Context.AddRpcLatency(additionalLatency, "Session dispose"); } } } if (base.Context != null) { MapiSubmissionInfo mapiSubmissionInfo = (MapiSubmissionInfo)base.Info; base.StoreDriverTracer.MapiStoreDriverSubmissionTracer.TracePass(base.StoreDriverTracer.MessageProbeActivityId, 0L, "Event {0}, Mailbox {1}, Mdb {2}, RPC latency {4}", new object[] { mapiSubmissionInfo.EventCounter, mapiSubmissionInfo.MailboxGuid, mapiSubmissionInfo.MdbGuid, base.Context.RpcLatency }); } } } finally { base.Dispose(disposing); } }
public SmtpMailItemResult Send(IReadOnlyMailItem readOnlyMailItem, bool useLocalHubOnly, TimeSpan waitTimeOut, ISmtpMailItemSenderNotifications notificationHandler) { if (readOnlyMailItem == null) { throw new ArgumentNullException("readOnlyMailItem"); } IEnumerable <INextHopServer> enumerable; if (useLocalHubOnly) { string text = SmtpMailItemSender.LocalFQDN; bool flag = SmtpMailItemSender.IsFrontendAndHubColocatedServer; if (string.IsNullOrEmpty(text)) { throw new InvalidOperationException("Email is unable to be sent because the name of the local machine can not be detemined."); } enumerable = new List <INextHopServer>(); ((List <INextHopServer>)enumerable).Add(new NextHopFqdn(text, flag)); } else { LatencyTracker.BeginTrackLatency(LatencyComponent.MailboxTransportSubmissionStoreDriverSubmissionHubSelector, readOnlyMailItem.LatencyTracker); if (!Components.ProxyHubSelectorComponent.ProxyHubSelector.TrySelectHubServers(readOnlyMailItem, out enumerable)) { throw new InvalidOperationException("Email is unable to be sent because Hub Selector didn't return any HUBs."); } LatencyTracker.EndTrackLatency(LatencyComponent.MailboxTransportSubmissionStoreDriverSubmissionHubSelector, readOnlyMailItem.LatencyTracker); } NextHopSolutionKey key = new NextHopSolutionKey(NextHopType.Empty, "MailboxTransportSubmissionInternalProxy", Guid.Empty); SmtpMailItemResult smtpMailItemResult; using (SmtpMailItemNextHopConnection smtpMailItemNextHopConnection = new SmtpMailItemNextHopConnection(key, readOnlyMailItem, notificationHandler)) { LatencyTracker.BeginTrackLatency(LatencyComponent.MailboxTransportSubmissionStoreDriverSubmissionSmtpOut, readOnlyMailItem.LatencyTracker); Components.SmtpOutConnectionHandler.HandleProxyConnection(smtpMailItemNextHopConnection, enumerable, true, null); smtpMailItemNextHopConnection.AckConnectionEvent.WaitOne(waitTimeOut); LatencyTracker.EndTrackLatency(LatencyComponent.MailboxTransportSubmissionStoreDriverSubmissionSmtpOut, readOnlyMailItem.LatencyTracker); smtpMailItemResult = smtpMailItemNextHopConnection.SmtpMailItemResult; } return(smtpMailItemResult); }
public void FinalizeDeliveryLatencyTracking(LatencyComponent deliveryComponent) { LatencyTracker.EndTrackLatency(LatencyComponent.Delivery, deliveryComponent, this.mailItem.LatencyTracker); }
public void TrackSuccessfulConnectLatency(LatencyComponent connectComponent) { LatencyTracker.EndTrackLatency(LatencyComponent.MailboxTransportSubmissionStoreDriverSubmissionSmtp, connectComponent, this.LatencyTracker); LatencyTracker.BeginTrackLatency(LatencyComponent.MailboxTransportSubmissionStoreDriverSubmissionSmtp, this.LatencyTracker); }