示例#1
0
        private void RegisterChangeNotificationForDeletedObject <TConfigObject>(ADObjectId parentContainerId, ADNotificationCallback adNotificationCallback) where TConfigObject : ADConfigurationObject, new()
        {
            TConfigObject         tconfigObject = Activator.CreateInstance <TConfigObject>();
            ADNotificationRequest request       = new ADNotificationRequest(tconfigObject.GetType(), tconfigObject.MostDerivedObjectClass, parentContainerId, adNotificationCallback, null);

            ADNotificationListener.RegisterChangeNotificationForDeletedObjects(request);
            this.typesRegisteredForDeleteNotifications.Add(tconfigObject.GetType());
        }
示例#2
0
 // Token: 0x06000358 RID: 856 RVA: 0x0001222C File Offset: 0x0001042C
 public static void UnregisterChangeNotification(ADNotificationRequestCookie requestCookie, bool block)
 {
     if (requestCookie == null)
     {
         throw new ArgumentNullException("requestCookie");
     }
     foreach (ADNotificationRequest request in requestCookie.Requests)
     {
         ADNotificationListener.UnRegisterChangeNotification(request, block);
     }
 }
 // Token: 0x0600001D RID: 29 RVA: 0x00002FEC File Offset: 0x000011EC
 private void UnRegisterConfigurationChangeHandlers()
 {
     ADNotificationListener.Stop();
     if (this.receiveConnectorNotificationCookie != null)
     {
         ExTraceGlobals.ServiceTracer.TraceDebug(0L, "TransportService unregister ReceiveConnector configuration change notifications");
         TransportADNotificationAdapter.Instance.UnregisterChangeNotification(this.receiveConnectorNotificationCookie);
     }
     if (this.serverNotificationCookie != null)
     {
         ExTraceGlobals.ServiceTracer.TraceDebug(0L, "TransportService unregister Server configuration change notifications");
         TransportADNotificationAdapter.Instance.UnregisterChangeNotification(this.serverNotificationCookie);
     }
 }
示例#4
0
        // Token: 0x06000006 RID: 6 RVA: 0x00002558 File Offset: 0x00000758
        protected override void OnStopInternal()
        {
            MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.StopService);
            MailboxTransportDeliveryService.isExiting = true;
            ADNotificationListener.Stop();
            MailboxTransportDeliveryService.diag.TraceDebug <DateTime>(0L, "Stopping MailTransportDeliveryService ({0})", DateTime.UtcNow);
            bool flag = false;

            try
            {
                MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.StopBackgroundThread);
                if (MailboxTransportDeliveryService.backgroundThread != null)
                {
                    MailboxTransportDeliveryService.backgroundThread.Stop();
                }
                if (this.isDiagnosticHandlerRegisteredForSettingOverrideSync)
                {
                    try
                    {
                        ProcessAccessManager.UnregisterComponent(SettingOverrideSync.Instance);
                    }
                    catch (RpcException ex)
                    {
                        MailboxTransportDeliveryService.diag.TraceError <string>(0L, "Failed to unregister SettingOverride component with Rpc Server. Error : {0}", ex.ToString());
                    }
                }
                SettingOverrideSync.Instance.Stop();
                MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.StopMessageTracking);
                MessageTrackingLog.Stop();
                MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.StopConfiguration);
                DeliveryConfiguration.Instance.Unload();
                MailboxTransportEventLogger.LogEvent(MSExchangeDeliveryEventLogConstants.Tuple_DeliveryServiceStopSuccess, null, new string[0]);
                MailboxTransportDeliveryService.diag.TraceDebug(0L, "Stopped MailboxDeliveryService");
                MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.UngregisterPamComponent);
                ProcessAccessManager.UnregisterComponent(this);
                MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.ServiceStopped);
                flag = true;
            }
            finally
            {
                if (!flag)
                {
                    MailboxTransportEventLogger.LogEvent(MSExchangeDeliveryEventLogConstants.Tuple_DeliveryServiceStopFailure, null, new string[0]);
                    MailboxTransportDeliveryService.diag.TraceError(0L, "Failed to stop MailboxDeliveryService");
                }
            }
            DeliveryThrottling.Instance.Dispose();
        }
        // Token: 0x06000019 RID: 25 RVA: 0x00002A5C File Offset: 0x00000C5C
        private void OnStopInternalHelper()
        {
            MailboxTransportSubmissionService.LogStage(MailboxTransportSubmissionService.Stage.StopService);
            ADNotificationListener.Stop();
            MailboxTransportSubmissionService.StoreDriverTracer.ServiceTracer.TracePass <DateTime>(MailboxTransportSubmissionService.StoreDriverTracer.MessageProbeActivityId, 0L, "Stopping MailboxTransportSubmissionService ({0})", DateTime.UtcNow);
            bool flag = false;

            try
            {
                MailboxTransportSubmissionService.LogStage(MailboxTransportSubmissionService.Stage.StopBackgroundThread);
                if (MailboxTransportSubmissionService.backgroundThread != null)
                {
                    MailboxTransportSubmissionService.backgroundThread.Stop();
                }
                MailboxTransportSubmissionService.LogStage(MailboxTransportSubmissionService.Stage.StopDatabaseManager);
                if (this.databaseManager != null)
                {
                    this.databaseManager.Stop();
                    this.databaseManager.Dispose();
                }
                MailboxTransportSubmissionService.LogStage(MailboxTransportSubmissionService.Stage.StopMessageTracking);
                MessageTrackingLog.Stop();
                MailboxTransportSubmissionService.LogStage(MailboxTransportSubmissionService.Stage.StopConfiguration);
                SubmissionConfiguration.Instance.Unload();
                MailboxTransportSubmissionEventLogger.LogEvent(MSExchangeSubmissionEventLogConstants.Tuple_SubmissionServiceStopSuccess, null, new object[0]);
                MailboxTransportSubmissionService.StoreDriverTracer.ServiceTracer.TracePass(MailboxTransportSubmissionService.StoreDriverTracer.MessageProbeActivityId, 0L, "Stopped MailboxTransportSubmissionService");
                MailboxTransportSubmissionService.LogStage(MailboxTransportSubmissionService.Stage.UngregisterPamComponent);
                ProcessAccessManager.UnregisterComponent(this);
                MailboxTransportSubmissionService.LogStage(MailboxTransportSubmissionService.Stage.ServiceStopped);
                flag = true;
            }
            finally
            {
                if (!flag)
                {
                    MailboxTransportSubmissionEventLogger.LogEvent(MSExchangeSubmissionEventLogConstants.Tuple_SubmissionServiceStopFailure, null, new object[0]);
                    MailboxTransportSubmissionService.StoreDriverTracer.ServiceTracer.TraceFail(MailboxTransportSubmissionService.StoreDriverTracer.MessageProbeActivityId, 0L, "Failed to stop MailboxTransportSubmissionService");
                }
            }
        }
示例#6
0
        // Token: 0x06000354 RID: 852 RVA: 0x00012094 File Offset: 0x00010294
        private static ADNotificationRequestCookie RegisterChangeNotification <T>(T dummyObject, ADObjectId baseDN, ADNotificationCallback callback, object context) where T : ADConfigurationObject, new()
        {
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }
            if (baseDN == null || string.IsNullOrEmpty(baseDN.DistinguishedName))
            {
                throw new ArgumentNullException("baseDN");
            }
            string forestFQDN = baseDN.GetPartitionId().ForestFQDN;

            if (!baseDN.IsDescendantOf(ADSession.GetConfigurationNamingContext(forestFQDN)) && !ADSession.IsTenantIdentity(baseDN, forestFQDN))
            {
                throw new ArgumentException(DirectoryStrings.ExArgumentException("baseDN", baseDN), "baseDN");
            }
            ADNotificationRequest adnotificationRequest = new ADNotificationRequest(typeof(T), dummyObject.MostDerivedObjectClass, baseDN, callback, context);

            ADNotificationListener.RegisterChangeNotification(adnotificationRequest);
            return(new ADNotificationRequestCookie(new ADNotificationRequest[]
            {
                adnotificationRequest
            }));
        }
 // Token: 0x06000012 RID: 18 RVA: 0x00002436 File Offset: 0x00000636
 protected override void OnStopInternal()
 {
     ADNotificationListener.Stop();
     this.components.Stop();
 }
示例#8
0
        // Token: 0x06000015 RID: 21 RVA: 0x00002D34 File Offset: 0x00000F34
        private void Run(string[] args)
        {
            bool   flag          = false;
            bool   passiveRole   = false;
            bool   flag2         = false;
            bool   flag3         = false;
            bool   selfListening = false;
            string text          = null;
            string name          = null;
            string name2         = null;
            string s             = null;
            string fullName      = Assembly.GetExecutingAssembly().FullName;

            ExTraceGlobals.GeneralTracer.TraceDebug <string>(0L, "Process {0} starting", fullName);
            foreach (string text2 in args)
            {
                if (text2.StartsWith("-?", StringComparison.Ordinal))
                {
                    Program.UsageAndExit();
                }
                else if (text2.StartsWith("-console", StringComparison.Ordinal))
                {
                    flag2 = true;
                }
                else if (text2.StartsWith("-stopkey:", StringComparison.Ordinal))
                {
                    text = text2.Remove(0, "-stopkey:".Length);
                }
                else if (text2.StartsWith("-hangkey:", StringComparison.Ordinal))
                {
                    name = text2.Remove(0, "-hangkey:".Length);
                }
                else if (text2.StartsWith("-resetkey:", StringComparison.Ordinal))
                {
                    text2.Remove(0, "-resetkey:".Length);
                }
                else if (text2.StartsWith("-readykey:", StringComparison.Ordinal))
                {
                    name2 = text2.Remove(0, "-readykey:".Length);
                }
                else if (text2.StartsWith("-pipe:", StringComparison.Ordinal))
                {
                    s = text2.Remove(0, "-pipe:".Length);
                }
                else if (text2.StartsWith("-passive", StringComparison.Ordinal))
                {
                    passiveRole = true;
                }
                else if (text2.StartsWith("-paused", StringComparison.Ordinal))
                {
                    flag = true;
                }
                else if (text2.StartsWith("-wait", StringComparison.Ordinal))
                {
                    flag3 = true;
                }
                else if (text2.StartsWith("-workerListening", StringComparison.Ordinal))
                {
                    selfListening = true;
                }
            }
            bool flag4 = !string.IsNullOrEmpty(text);

            if (!flag4)
            {
                if (!flag2)
                {
                    Program.UsageAndExit();
                }
                Console.WriteLine("Starting {0}, running in console mode.", Assembly.GetExecutingAssembly().GetName().Name);
                if (flag3)
                {
                    Console.WriteLine("Press ENTER to continue.");
                    Console.ReadLine();
                }
            }
            string error;

            if (!Components.TryLoadTransportAppConfig(out error))
            {
                this.StopService(Strings.AppConfigLoadFailure(error), false, false, false);
                return;
            }
            this.SetThreadPoolLimits(Components.TransportAppConfig);
            this.stopHandle  = Program.OpenSemaphore(text, "stop");
            this.hangHandle  = Program.OpenSemaphore(name, "hang");
            this.readyHandle = Program.OpenSemaphore(name2, "ready");
            if (this.hangHandle != null)
            {
                Thread thread = new Thread(new ThreadStart(this.WaitForHangSignal));
                thread.Start();
            }
            Globals.InitializeMultiPerfCounterInstance("Transport");
            ExTraceGlobals.GeneralTracer.TraceDebug(0L, "Program.Run() starting components.");
            SettingOverrideSync.Instance.Start(true);
            if (!VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Transport.ADExceptionHandling.Enabled)
            {
                Program.ConstructComponentLoadTree();
            }
            else
            {
                ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(new ADOperation(Program.ConstructComponentLoadTree), 3);
                if (!adoperationResult.Succeeded)
                {
                    ExTraceGlobals.GeneralTracer.TraceError <Exception>(0L, "Construct components load tree failed {0}.", adoperationResult.Exception);
                    Program.eventLogger.LogEvent(TransportEventLogConstants.Tuple_EdgeTransportInitializationFailure, null, new object[]
                    {
                        adoperationResult.Exception.ToString()
                    });
                    bool canRetry = adoperationResult.ErrorCode == ADOperationErrorCode.RetryableError;
                    this.StopService(Strings.ADOperationFailure(adoperationResult.Exception.ToString()), canRetry, false, true);
                    return;
                }
            }
            string componentId = ServerComponentStates.GetComponentId(this.CalculateServerComponentName());

            this.transportComponents = new Components(componentId, true);
            this.transportComponents.Start(new Components.StopServiceHandler(this.StopService), passiveRole, flag4, selfListening, true);
            if (flag4)
            {
                SafeFileHandle handle = new SafeFileHandle(new IntPtr(long.Parse(s)), true);
                this.listenPipeStream = new PipeStream(handle, FileAccess.Read, true);
                this.controlObject    = new ControlObject(this.listenPipeStream, this);
                if (this.controlObject.Initialize())
                {
                    if (this.readyHandle != null)
                    {
                        ExTraceGlobals.GeneralTracer.TraceDebug(0L, "Signal the process is ready");
                        this.readyHandle.Release();
                        this.readyHandle.Close();
                        this.readyHandle = null;
                    }
                    ExTraceGlobals.GeneralTracer.TraceDebug(0L, "Start processing stored messages.");
                    if (!flag)
                    {
                        this.transportComponents.Continue();
                    }
                    ExTraceGlobals.GeneralTracer.TraceDebug(0L, "Waiting for shutdown signal to exit.");
                    this.stopHandle.WaitOne();
                }
            }
            else
            {
                ExTraceGlobals.GeneralTracer.TraceDebug(0L, "Service connected. Start processing messages.");
                if (!flag)
                {
                    this.transportComponents.Continue();
                }
                Console.WriteLine("Press ENTER to exit ");
                bool flag5 = false;
                while (!flag5)
                {
                    string text3 = Console.ReadLine();
                    if (string.IsNullOrEmpty(text3))
                    {
                        Console.WriteLine("Exiting.");
                        flag5 = true;
                    }
                    else if (text3.Equals("p"))
                    {
                        Console.WriteLine("Pause.");
                        this.transportComponents.Pause();
                    }
                    else if (text3.Equals("c"))
                    {
                        Console.WriteLine("Continue.");
                        this.transportComponents.Continue();
                    }
                    else
                    {
                        Console.WriteLine("Unknown command.");
                    }
                }
            }
            ExTraceGlobals.GeneralTracer.TraceDebug(0L, "Received a signal to shut down.  Closing control pipe.");
            this.CloseControlPipeStream();
            ExTraceGlobals.GeneralTracer.TraceDebug(0L, "Stopping components.");
            ADNotificationListener.Stop();
            this.transportComponents.Stop();
            ExTraceGlobals.GeneralTracer.TraceDebug(0L, "Components stopped.");
        }