private static void InitializeSmtpLatencyTracking(LatencyTracker latencyTracker)
 {
     if (Components.Configuration.ProcessTransportRole == ProcessTransportRole.MailboxSubmission)
     {
         LatencyTracker.BeginTrackLatency(LatencyComponent.MailboxTransportSubmissionStoreDriverSubmissionSmtp, latencyTracker);
     }
 }
 private static void EndSmtpLatencyTracking(LatencyTracker latencyTracker)
 {
     if (Components.Configuration.ProcessTransportRole == ProcessTransportRole.MailboxSubmission)
     {
         LatencyTracker.EndTrackLatency(LatencyComponent.MailboxTransportSubmissionStoreDriverSubmissionSmtp, LatencyComponent.SmtpSend, latencyTracker);
     }
 }
        // Token: 0x0600143B RID: 5179 RVA: 0x0004A334 File Offset: 0x00048534
        private static void SendAuthenticationDataToWinRM(HttpContext httpContext, UserToken userToken)
        {
            WinRMInfo winRMInfo = httpContext.Items["X-RemotePS-WinRMInfo"] as WinRMInfo;

            if (ProxySecurityContextModule.NeedSendDataToWinRM(winRMInfo))
            {
                userToken.UniformCommonAccessToken();
                if (winRMInfo != null && "New-PSSession".Equals(winRMInfo.Action, StringComparison.OrdinalIgnoreCase))
                {
                    HttpLogger.SafeAppendGenericInfo("WinRMCAT", userToken.GetReadableCommonAccessToken());
                }
                LatencyTracker latencyTracker = HttpContext.Current.Items["Logging-HttpRequest-Latency"] as LatencyTracker;
                using (WinRMDataSender winRMDataSender = new WinRMDataSender(httpContext, latencyTracker))
                {
                    winRMDataSender.SessionId = winRMInfo.FomattedSessionId;
                    if (HttpLogger.ActivityScope != null)
                    {
                        Guid activityId = HttpLogger.ActivityScope.ActivityId;
                        winRMDataSender.RequestId = HttpLogger.ActivityScope.ActivityId.ToString();
                    }
                    winRMDataSender.UserToken = userToken;
                    winRMDataSender.Send();
                }
            }
        }
Ejemplo n.º 4
0
        // 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);
            }
        }
Ejemplo n.º 5
0
 public void Load()
 {
     if (!this.isInitialized)
     {
         SubmissionConfiguration.components.Start(new Components.StopServiceHandler(SubmissionConfiguration.OnStopServiceBecauseOfFailure), false, false, true, true);
         SubmissionConfiguration.components.Continue();
         Components.StoreDriverSubmission.Continue();
         LatencyTracker.Start(Components.TransportAppConfig.LatencyTracker, ProcessTransportRole.MailboxSubmission);
         SubmissionConfiguration.StartSystemProbe();
         this.isInitialized = true;
     }
 }
 public void Load(IMbxDeliveryListener submitHandler)
 {
     if (!this.isInitialized)
     {
         DeliveryConfiguration.app.Load();
         this.submitHandler = submitHandler;
         this.ConstructComponentLoadTree();
         DeliveryConfiguration.components.Start(new Components.StopServiceHandler(DeliveryConfiguration.OnStopServiceBecauseOfFailure), false, false, true, true);
         DeliveryConfiguration.components.Continue();
         MessageTrackingLog.Configure(Components.Configuration.LocalServer.TransportServer);
         LatencyTracker.Start(Components.TransportAppConfig.LatencyTracker, ProcessTransportRole.MailboxDelivery);
         this.isInitialized = true;
     }
 }
Ejemplo n.º 7
0
 public WinRMDataSender(HttpContext context, LatencyTracker latencyTracker)
 {
     WinRMDataSender < > 4__this = this;
     CoreLogger.ExecuteAndLog("WinRMDataSender.Ctor", true, null, null, delegate()
     {
         if (!WinRMDataExchangeHelper.IsExchangeDataUseAuthenticationType() && !WinRMDataExchangeHelper.IsExchangeDataUseNamedPipe())
         {
             throw new InvalidFlightingException();
         }
         if (context.User == null || context.User.Identity == null)
         {
             throw new ArgumentException("context.User and context.User.Identity should not be null.");
         }
         < > 4__this.httpContext    = context;
Ejemplo n.º 8
0
        // Token: 0x06000039 RID: 57 RVA: 0x00003A30 File Offset: 0x00001C30
        private void LogAndUpdateCounters(MapiEvent mapiEvent, LatencyTracker latencyTracker, DateTime arrivalTime, MailSubmissionResult result)
        {
            LatencyFormatter latencyFormatter = new LatencyFormatter(latencyTracker, Components.Configuration.LocalServer.TransportServer.Fqdn, arrivalTime, arrivalTime, true, false, true);
            string           text             = latencyFormatter.FormatAndUpdatePerfCounters();

            this.LogMessageTrackingInfo(result.RemoteHostName, StoreDriverSubmission.LocalIPAddress, Components.Configuration.LocalServer.TransportServer.Name, mapiEvent, result, text);
            if (result.ErrorCode == 0U)
            {
                MailboxTransportSubmissionAssistant.IncrementSuccessfulSubmissionPerfmon();
                if (MailboxTransportSubmissionService.StoreDriverTracer.IsMessageAMapiSubmitLAMProbe)
                {
                    MailItemSubmitter.WriteLamNotificationEvent("EventHandled", text, result.MessageId, mapiEvent.MailboxGuid, MailboxTransportSubmissionService.StoreDriverTracer.MessageProbeLamNotificationIdParts);
                }
            }
        }
Ejemplo n.º 9
0
        private void AddComponent(string serverName, string code, ushort latency)
        {
            if (this.components == null)
            {
                this.components = new LinkedList <LatencyComponent>();
            }
            LocalizedString fullName = LatencyTracker.GetFullName(code);

            if (LocalizedString.Empty.Equals(fullName))
            {
                fullName = new LocalizedString(code);
            }
            LatencyComponent value = new LatencyComponent(serverName, code, fullName, latency, this.componentSequenceNumber++);

            this.components.AddLast(value);
        }
Ejemplo n.º 10
0
        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();
        }
Ejemplo n.º 11
0
 private void OnEndRequest(object sender, EventArgs e)
 {
     ExTraceGlobals.HttpModuleTracer.TraceFunction((long)this.GetHashCode(), "[LoggingEndModule::OnEndRequest] Enter");
     if (HttpLogger.LoggerNotDisposed)
     {
         try
         {
             HttpContext  httpContext = HttpContext.Current;
             HttpResponse response    = httpContext.Response;
             HttpLogger.SafeSetLogger(ConfigurationCoreMetadata.SubStatus, response.SubStatusCode);
             CPUMemoryLogger.Log();
             LatencyTracker latencyTracker = HttpContext.Current.Items["Logging-HttpRequest-Latency"] as LatencyTracker;
             if (latencyTracker != null)
             {
                 long num = latencyTracker.Stop();
                 HttpLogger.SafeSetLogger(ConfigurationCoreMetadata.TotalTime, num);
                 latencyTracker.PushLatencyDetailsToLog(null, null, delegate(string funcName, string totalLatency)
                 {
                     HttpLogger.SafeAppendColumn(RpsCommonMetadata.GenericLatency, funcName, totalLatency);
                 });
                 if (Constants.IsPowerShellWebService)
                 {
                     PswsPerfCounter.UpdatePerfCounter(num);
                 }
                 else
                 {
                     RPSPerfCounter.UpdateAverageRTCounter(num);
                 }
             }
             else
             {
                 HttpLogger.SafeAppendColumn(RpsCommonMetadata.GenericLatency, "LatencyMissed", "httpRequestLatencyTracker is null");
             }
             HttpLogger.SafeAppendGenericInfo("OnEndRequest.End.ContentType", response.ContentType);
         }
         finally
         {
             if (HttpLogger.ActivityScope != null)
             {
                 RequestMonitor.Instance.UnRegisterRequest(HttpLogger.ActivityScope.ActivityId);
             }
             HttpLogger.AsyncCommit(false);
         }
     }
     ExTraceGlobals.HttpModuleTracer.TraceFunction((long)this.GetHashCode(), "[LoggingEndModule::OnEndRequest] Exit");
 }
Ejemplo n.º 12
0
 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);
     }
 }
Ejemplo n.º 13
0
        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);
        }
Ejemplo n.º 14
0
        // Token: 0x060012DD RID: 4829 RVA: 0x0003D4C8 File Offset: 0x0003B6C8
        internal static T ExecuteWSManPluginAPI <T>(string funcName, bool throwException, bool trackLatency, T defaultReturnValue, Func <T> func)
        {
            ExWatson.IsExceptionInteresting isExceptionInteresting = null;
            T result;

            try
            {
                AuthZLogger.SafeAppendColumn(RpsCommonMetadata.GenericLatency, funcName, DateTime.UtcNow.ToString());
                string                funcName2       = funcName;
                bool                  throwException2 = throwException;
                LatencyTracker        latencyTracker  = trackLatency ? AuthZLogHelper.latencyTracker : null;
                ExEventLog            rbacEventLogger = AuthZLogHelper.RbacEventLogger;
                ExEventLog.EventTuple tuple_RemotePSPublicAPIFailed = Microsoft.Exchange.Configuration.ObjectModel.EventLog.TaskEventLogConstants.Tuple_RemotePSPublicAPIFailed;
                Trace                 publicPluginAPITracer         = Microsoft.Exchange.Diagnostics.Components.Authorization.ExTraceGlobals.PublicPluginAPITracer;
                if (isExceptionInteresting == null)
                {
                    isExceptionInteresting = ((object ex) => AuthZPluginHelper.IsFatalException(ex as Exception));
                }
                result = Diagnostics.ExecuteAndLog <T>(funcName2, throwException2, latencyTracker, rbacEventLogger, tuple_RemotePSPublicAPIFailed, publicPluginAPITracer, isExceptionInteresting, delegate(Exception ex)
                {
                    AuthZLogHelper.LogException(ex, funcName, throwException);
                }, defaultReturnValue, () => AuthZLogHelper.HandleExceptionAndRetry <T>(funcName, func, throwException, defaultReturnValue));
            }
            catch (Exception ex)
            {
                string arg = (AuthZLogger.ActivityScope != null) ? AuthZLogger.ActivityScope.ActivityId.ToString() : null;
                AuthZLogHelper.EndLogging(true);
                Exception              ex3;
                string                 str     = string.Format("[FailureCategory={0}] ", FailureCategory.AuthZ + "-" + ex3.GetType().Name);
                string                 str2    = string.Format("[AuthZRequestId={0}]", arg);
                LocalizedString        message = new LocalizedString(str2 + str + ex3.Message);
                AuthorizationException ex2     = new AuthorizationException(message, ex3);
                throw ex2;
            }
            return(result);
        }
        // Token: 0x060000D4 RID: 212 RVA: 0x00005FE8 File Offset: 0x000041E8
        private void OnBeginRequest(object sender, EventArgs e)
        {
            ExTraceGlobals.HttpModuleTracer.TraceFunction((long)this.GetHashCode(), "[LoggingStartModule::OnBeginRequest] Enter");
            LatencyTracker latencyTracker = new LatencyTracker(Constants.IsPowerShellWebService ? "Psws.HttpModule" : "Rps.HttpModule", null);

            latencyTracker.Start();
            HttpContext         httpContext = HttpContext.Current;
            HttpRequest         request     = httpContext.Request;
            NameValueCollection headers     = httpContext.Request.Headers;

            httpContext.Items["Logging-HttpRequest-Latency"] = latencyTracker;
            HttpLogger.InitializeRequestLogger();
            if (HttpLogger.ActivityScope != null)
            {
                HttpLogger.ActivityScope.UpdateFromMessage(HttpContext.Current.Request);
                HttpLogger.ActivityScope.SerializeTo(HttpContext.Current.Response);
            }
            if (Constants.IsRemotePS && HttpLogger.ActivityScope != null && request.Url.Port == 444)
            {
                Uri url = request.Url;
                NameValueCollection urlProperties = url.GetUrlProperties();
                string text = urlProperties["RequestId48CD6591-0506-4D6E-9131-797489A3260F"];
                Guid   guid;
                if (text != null && Guid.TryParse(text, out guid))
                {
                    LoggerHelper.UpdateActivityScopeRequestIdFromUrl(url.ToString());
                }
            }
            HttpLogger.SafeSetLogger(ServiceCommonMetadata.HttpMethod, request.HttpMethod);
            WinRMInfo winRMInfoFromHttpHeaders = WinRMInfo.GetWinRMInfoFromHttpHeaders(headers);

            if (winRMInfoFromHttpHeaders != null)
            {
                HttpLogger.SafeSetLogger(RpsHttpMetadata.Action, winRMInfoFromHttpHeaders.Action);
                HttpLogger.SafeSetLogger(RpsCommonMetadata.SessionId, winRMInfoFromHttpHeaders.SessionId);
                HttpLogger.SafeSetLogger(RpsHttpMetadata.ShellId, winRMInfoFromHttpHeaders.ShellId);
                HttpLogger.SafeSetLogger(RpsHttpMetadata.CommandId, winRMInfoFromHttpHeaders.CommandId);
                HttpLogger.SafeSetLogger(RpsHttpMetadata.CommandName, winRMInfoFromHttpHeaders.CommandName);
                httpContext.Items["X-RemotePS-WinRMInfo"] = winRMInfoFromHttpHeaders;
            }
            string sourceCafeServer = CafeHelper.GetSourceCafeServer(request);

            if (sourceCafeServer != null)
            {
                HttpLogger.SafeSetLogger(ConfigurationCoreMetadata.FrontEndServer, sourceCafeServer);
            }
            Uri url2 = request.Url;

            if (url2.IsAbsoluteUri)
            {
                HttpLogger.SafeSetLogger(ConfigurationCoreMetadata.UrlHost, url2.DnsSafeHost);
                HttpLogger.SafeSetLogger(ConfigurationCoreMetadata.UrlStem, url2.LocalPath);
                HttpLogger.SafeSetLogger(ConfigurationCoreMetadata.UrlQuery, url2.Query);
            }
            else
            {
                HttpLogger.SafeAppendGenericError("InvalidRelativeUri", url2.ToString(), false);
            }
            NameValueCollection urlProperties2 = url2.GetUrlProperties();

            if (urlProperties2 != null)
            {
                string text2;
                if (!string.IsNullOrWhiteSpace(text2 = urlProperties2["Organization"]))
                {
                    HttpLogger.SafeSetLogger(ConfigurationCoreMetadata.ManagedOrganization, text2);
                }
                else if (!string.IsNullOrWhiteSpace(text2 = urlProperties2["DelegatedOrg"]))
                {
                    HttpLogger.SafeSetLogger(ConfigurationCoreMetadata.ManagedOrganization, "Delegate:" + text2);
                }
            }
            if (HttpLogger.ActivityScope != null)
            {
                using (new MonitoredScope("RequestMonitor.Register", "RequestMonitor.Register", HttpModuleHelper.HttpPerfMonitors))
                {
                    RequestMonitor.Instance.RegisterRequest(HttpLogger.ActivityScope.ActivityId);
                    string text3 = headers[WellKnownHeader.WLIDMemberName] ?? headers[WellKnownHeader.LiveIdMemberName];
                    if (!string.IsNullOrEmpty(text3))
                    {
                        SmtpAddress smtpAddress = new SmtpAddress(text3);
                        RequestMonitor.Instance.Log(HttpLogger.ActivityScope.ActivityId, RequestMonitorMetadata.AuthenticatedUser, text3);
                        RequestMonitor.Instance.Log(HttpLogger.ActivityScope.ActivityId, RequestMonitorMetadata.Organization, smtpAddress.Domain);
                    }
                    RequestMonitor.Instance.Log(HttpLogger.ActivityScope.ActivityId, RequestMonitorMetadata.FrontEndServer, sourceCafeServer);
                    RequestMonitor.Instance.Log(HttpLogger.ActivityScope.ActivityId, RequestMonitorMetadata.ProtocolAction, HttpLogger.ActivityScope.GetProperty(RpsHttpMetadata.Action));
                }
            }
            ExTraceGlobals.HttpModuleTracer.TraceFunction((long)this.GetHashCode(), "[LoggingStartModule::OnBeginRequest] Exit");
        }
Ejemplo n.º 16
0
 // Token: 0x0600002B RID: 43 RVA: 0x000037F4 File Offset: 0x000019F4
 private static void BeginTrackLatency(MapiEvent mapiEvent, LatencyTracker latencyTracker, LatencyComponent latencyComponent)
 {
     MailboxTransportSubmissionAssistant.LatencyRecord value = new MailboxTransportSubmissionAssistant.LatencyRecord(latencyTracker, latencyComponent);
     MailboxTransportSubmissionAssistant.eventCounterToLatencyMap[mapiEvent.EventCounter] = value;
     LatencyTracker.BeginTrackLatency(latencyComponent, latencyTracker);
 }
Ejemplo n.º 17
0
        public MailSubmissionResult SubmitMessage(string serverDN, Guid mailboxGuid, Guid mdbGuid, string databaseName, long eventCounter, byte[] entryId, byte[] parentEntryId, string serverFqdn, IPAddress networkAddressBytes, DateTime originalCreateTime, bool isPublicFolder, TenantPartitionHint tenantHint, string mailboxHopLatency, QuarantineHandler quarantineHandler, SubmissionPoisonHandler submissionPoisonHandler, LatencyTracker latencyTracker)
        {
            ArgumentValidator.ThrowIfNullOrEmpty("serverDN", serverDN);
            ArgumentValidator.ThrowIfEmpty("mailboxGuid", mailboxGuid);
            ArgumentValidator.ThrowIfEmpty("mdbGuid", mdbGuid);
            ArgumentValidator.ThrowIfNullOrEmpty("databaseName", databaseName);
            ArgumentValidator.ThrowIfNull("entryId", entryId);
            ArgumentValidator.ThrowIfInvalidValue <int>("entryId", entryId.Length, (int value) => value > 0);
            ArgumentValidator.ThrowIfNull("parentEntryId", parentEntryId);
            ArgumentValidator.ThrowIfInvalidValue <int>("parentEntryId", parentEntryId.Length, (int value) => value > 0);
            ArgumentValidator.ThrowIfNullOrEmpty("serverFqdn", serverFqdn);
            ArgumentValidator.ThrowIfNull("networkAddressBytes", networkAddressBytes);
            ArgumentValidator.ThrowIfNullOrEmpty("mailboxHopLatency", mailboxHopLatency);
            ArgumentValidator.ThrowIfNull("quarantineHandler", quarantineHandler);
            ArgumentValidator.ThrowIfNull("submissionPoisonHandler", submissionPoisonHandler);
            bool shouldDeprioritize = false;

            if (SubmissionConfiguration.Instance.App.SenderRateDeprioritizationEnabled)
            {
                long num = this.rateTrackerForDeprioritization.IncrementSenderRate(mailboxGuid, originalCreateTime);
                if (num > (long)SubmissionConfiguration.Instance.App.SenderRateDeprioritizationThreshold)
                {
                    shouldDeprioritize = true;
                }
            }
            bool shouldThrottle = false;

            if (SubmissionConfiguration.Instance.App.SenderRateThrottlingEnabled)
            {
                long num2 = this.rateTrackerForThrottling.IncrementSenderRate(mailboxGuid, originalCreateTime);
                if (num2 > (long)SubmissionConfiguration.Instance.App.SenderRateThrottlingThreshold)
                {
                    shouldThrottle = true;
                    this.rateTrackerForThrottling.ResetSenderRate(mailboxGuid, originalCreateTime);
                }
            }
            MapiSubmissionInfo submissionInfo = new MapiSubmissionInfo(serverDN, mailboxGuid, entryId, parentEntryId, eventCounter, serverFqdn, networkAddressBytes, mdbGuid, databaseName, originalCreateTime, isPublicFolder, tenantHint, mailboxHopLatency, latencyTracker, shouldDeprioritize, shouldThrottle, this.storeDriverTracer);

            return(this.SubmitMessageImpl(submissionInfo, submissionPoisonHandler, quarantineHandler));
        }
Ejemplo n.º 18
0
 public MapiSubmissionInfo(string serverDN, Guid mailboxGuid, byte[] entryId, byte[] parentEntryId, long eventCounter, string serverFqdn, IPAddress networkAddress, Guid mdbGuid, string databaseName, DateTime originalCreateTime, bool isPublicFolder, TenantPartitionHint tenantHint, string mailboxHopLatency, LatencyTracker latencyTracker, bool shouldDeprioritize, bool shouldThrottle, IStoreDriverTracer storeDriverTracer) : base(serverDN, serverFqdn, networkAddress, mdbGuid, databaseName, originalCreateTime, tenantHint, mailboxHopLatency, latencyTracker, shouldDeprioritize, shouldThrottle)
 {
     this.mailboxGuid       = mailboxGuid;
     this.entryId           = entryId;
     this.parentEntryId     = parentEntryId;
     this.eventCounter      = eventCounter;
     this.isPublicFolder    = isPublicFolder;
     this.storeDriverTracer = storeDriverTracer;
 }
Ejemplo n.º 19
0
 // Token: 0x06000080 RID: 128 RVA: 0x00004400 File Offset: 0x00002600
 public WinRMDataReceiver(string connectionUrl, string userName, string authenticationType, LatencyTracker latencyTracker)
 {
     WinRMDataReceiver < > 4__this = this;
     if (!WinRMDataExchangeHelper.IsExchangeDataUseAuthenticationType() && !WinRMDataExchangeHelper.IsExchangeDataUseNamedPipe())
     {
         throw new InvalidFlightingException();
     }
     CoreLogger.ExecuteAndLog("WinRMDataReceiver.Ctor", true, latencyTracker, delegate(Exception ex)
     {
         AuthZLogger.SafeAppendGenericError("WinRMDataReceiver.Ctor", ex.ToString(), false);
     }, delegate()
     {
         < > 4__this.latencyTracker = latencyTracker;
         if (WinRMDataExchangeHelper.IsExchangeDataUseAuthenticationType())
         {
             WinRMDataExchangeHelper.DehydrateAuthenticationType(authenticationType, out < > 4__this.authenticationType, out < > 4__this.serializedData);
         }
         else
         {
Ejemplo n.º 20
0
        // Token: 0x0600003D RID: 61 RVA: 0x00003D68 File Offset: 0x00001F68
        private void HandleEventError(MapiEvent mapiEvent, MailSubmissionResult result, LatencyTracker latencyTracker, string eventContext)
        {
            uint errorCode = result.ErrorCode;

            if (errorCode == 22U)
            {
                MailboxTransportSubmissionAssistant.IncrementSuccessfulPoisonNdrSubmissionPerfmon();
            }
            else if (errorCode == 23U)
            {
                MailboxTransportSubmissionAssistant.IncrementPermanentFailedPoisonNdrSubmissionPerfmon();
            }
            else if (HResult.IsHandled(errorCode))
            {
                if (HResult.IsNonActionable(errorCode))
                {
                    MailboxTransportSubmissionAssistant.IncrementNonActionableFailedSubmissionPerfmon();
                }
                else if (!HResult.IsMessageSubmittedOrHasNoRcpts(errorCode))
                {
                    MailboxTransportSubmissionAssistant.IncrementFailedSubmissionPerfmon();
                }
            }
            else if (HResult.IsRetryableAtCurrentHub(errorCode))
            {
                MailboxTransportSubmissionAssistant.IncrementTemporarySubmissionFailuresPerfmon();
            }
            MailboxTransportSubmissionAssistant.ComputePercentSubmissionsPerfmon(false);
            if (11U == errorCode)
            {
                MailboxTransportSubmissionService.StoreDriverTracer.ServiceTracer.TraceFail <string>(MailboxTransportSubmissionService.StoreDriverTracer.MessageProbeActivityId, (long)this.GetHashCode(), "Submission for message {0} was throttled, retry happens in 1 minute.", mapiEvent.ItemEntryIdString);
                MailboxTransportSubmissionAssistant.BeginTrackLatency(mapiEvent, latencyTracker, LatencyComponent.SubmissionAssistantThrottling);
                throw new TransientMailboxException(MailboxTransportSubmissionAssistant.RetryScheduleMessageThrottling);
            }
            if (errorCode == 1140850696U)
            {
                MailboxTransportSubmissionService.StoreDriverTracer.ServiceTracer.TraceFail <uint, string>(MailboxTransportSubmissionService.StoreDriverTracer.MessageProbeActivityId, (long)this.GetHashCode(), "Resource is in Quarantined State. Error Code: {0}; Event Context: {1}", errorCode, eventContext);
                throw new TransientMailboxException(new RetrySchedule(FinalAction.RetryForever, TimeSpan.MaxValue, new TimeSpan[]
                {
                    result.QuarantineTimeSpan
                }));
            }
            if (24U == errorCode)
            {
                MailboxTransportSubmissionService.StoreDriverTracer.ServiceTracer.TraceFail <uint, string>(MailboxTransportSubmissionService.StoreDriverTracer.MessageProbeActivityId, (long)this.GetHashCode(), "NDR for Poison Message was not successful. Retry. Error Code: {0}, Event context: {1}.", errorCode, eventContext);
                MailboxTransportSubmissionAssistant.IncrementTemporaryPoisonNdrSubmissionFailuresPerfmon();
                throw new TransientServerException(MailboxTransportSubmissionAssistant.RetrySchedulePoisonNdr);
            }
            if (HResult.IsHandled(errorCode))
            {
                MailboxTransportSubmissionService.StoreDriverTracer.ServiceTracer.TraceFail <uint, string>(MailboxTransportSubmissionService.StoreDriverTracer.MessageProbeActivityId, (long)this.GetHashCode(), "Submission was handled.  Error code {0}, event context {1}.", errorCode, eventContext);
                return;
            }
            if (2684354560U == errorCode)
            {
                MailboxTransportSubmissionService.StoreDriverTracer.ServiceTracer.TraceFail <string>(MailboxTransportSubmissionService.StoreDriverTracer.MessageProbeActivityId, (long)this.GetHashCode(), "Submission for message {0} was throttled at smtp, retry happens in 1 minute.", mapiEvent.ItemEntryIdString);
                throw new TransientMailboxException(MailboxTransportSubmissionAssistant.RetryScheduleGeneric);
            }
            if (HResult.IsRetryableAtCurrentHub(errorCode))
            {
                MailboxTransportSubmissionService.StoreDriverTracer.ServiceTracer.TraceFail <uint, string>(MailboxTransportSubmissionService.StoreDriverTracer.MessageProbeActivityId, (long)this.GetHashCode(), "Submission was not successful. Retry at current hub error code {0}, event context {1}.", errorCode, eventContext);
                if (HResult.IsRetryMailbox(errorCode))
                {
                    throw new TransientMailboxException(MailboxTransportSubmissionAssistant.RetryScheduleGeneric);
                }
                if (HResult.IsRetryMailboxDatabase(errorCode))
                {
                    throw new TransientDatabaseException(MailboxTransportSubmissionAssistant.RetryScheduleGeneric);
                }
                if (HResult.IsRetryMailboxServer(errorCode))
                {
                    throw new TransientServerException(MailboxTransportSubmissionAssistant.RetryScheduleGeneric);
                }
                return;
            }
            else
            {
                if (HResult.IsRetryableAtOtherHub(errorCode))
                {
                    MailboxTransportSubmissionService.StoreDriverTracer.ServiceTracer.TraceFail <uint, string>(MailboxTransportSubmissionService.StoreDriverTracer.MessageProbeActivityId, (long)this.GetHashCode(), "Submission was not successful. Retry other hub error code {0}, event context {1}.", errorCode, eventContext);
                    throw new TransientServerException(MailboxTransportSubmissionAssistant.RetryScheduleGeneric);
                }
                throw new InvalidOperationException("Internal error. ErrorCode is: " + errorCode);
            }
        }
Ejemplo n.º 21
0
 internal static T ExecuteAndLog <T>(string funcName, bool missionCritical, LatencyTracker latencyTracker, Action <Exception> onError, T defaultReturnValue, Func <T> func)
 {
     return(Diagnostics.ExecuteAndLog <T>(funcName, missionCritical, latencyTracker, Constants.CoreEventLogger, TaskEventLogConstants.Tuple_NonCrashingException, ExTraceGlobals.InstrumentationTracer, (object ex) => false, onError, defaultReturnValue, func));
 }
Ejemplo n.º 22
0
 internal static void ExecuteAndLog(string funcName, bool missionCritical, LatencyTracker latencyTracker, Action <Exception> onError, Action action)
 {
     Diagnostics.ExecuteAndLog(funcName, missionCritical, latencyTracker, Constants.CoreEventLogger, TaskEventLogConstants.Tuple_NonCrashingException, ExTraceGlobals.InstrumentationTracer, (object ex) => false, onError, action);
 }
Ejemplo n.º 23
0
 protected SubmissionInfo(string serverDN, string serverFqdn, IPAddress networkAddress, Guid mdbGuid, string databaseName, DateTime originalCreateTime, TenantPartitionHint tenantHint, string mailboxHopLatency, LatencyTracker latencyTracker, bool shouldDeprioritize, bool shouldThrottle)
 {
     this.serverDN           = serverDN;
     this.serverFqdn         = serverFqdn;
     this.networkAddress     = networkAddress;
     this.mdbGuid            = mdbGuid;
     this.databaseName       = databaseName;
     this.originalCreateTime = originalCreateTime;
     this.tenantHint         = tenantHint;
     this.mailboxHopLatency  = mailboxHopLatency;
     this.latencyTracker     = latencyTracker;
     this.shouldDeprioritize = shouldDeprioritize;
     this.shouldThrottle     = shouldThrottle;
 }
Ejemplo n.º 24
0
 // Token: 0x0600003F RID: 63 RVA: 0x00004116 File Offset: 0x00002316
 internal LatencyRecord(LatencyTracker latencyTracker, LatencyComponent latencyComponent)
 {
     this.latencyTracker   = latencyTracker;
     this.latencyComponent = latencyComponent;
 }
Ejemplo n.º 25
0
 public void FinalizeDeliveryLatencyTracking(LatencyComponent deliveryComponent)
 {
     LatencyTracker.EndTrackLatency(LatencyComponent.Delivery, deliveryComponent, this.mailItem.LatencyTracker);
 }
Ejemplo n.º 26
0
 public void TrackSuccessfulConnectLatency(LatencyComponent connectComponent)
 {
     LatencyTracker.EndAndBeginTrackLatency(connectComponent, LatencyComponent.Delivery, this.mailItem.LatencyTracker);
 }
 public void TrackSuccessfulConnectLatency(LatencyComponent connectComponent)
 {
     LatencyTracker.EndTrackLatency(LatencyComponent.MailboxTransportSubmissionStoreDriverSubmissionSmtp, connectComponent, this.LatencyTracker);
     LatencyTracker.BeginTrackLatency(LatencyComponent.MailboxTransportSubmissionStoreDriverSubmissionSmtp, this.LatencyTracker);
 }