コード例 #1
0
        // Token: 0x0600239B RID: 9115 RVA: 0x000A7264 File Offset: 0x000A5464
        public static void StopMonitoring()
        {
            ExTraceGlobals.MonitoredDatabaseTracer.TraceDebug(0L, "StopMonitoring:starting");
            TcpListener tcpListener = null;

            lock (RemoteDataProvider.s_singletonLock)
            {
                RemoteDataProvider.s_initialized = false;
                tcpListener = RemoteDataProvider.s_tcpListener;
                RemoteDataProvider.s_tcpListener = null;
                ClusterBatchWriter.Stop();
            }
            if (tcpListener != null)
            {
                tcpListener.Stop();
            }
            if (tcpListener != null)
            {
                MonitoredDatabase[] allInstances = RemoteDataProvider.s_databases.GetAllInstances();
                foreach (MonitoredDatabase monitoredDatabase in allInstances)
                {
                    RemoteDataProvider.s_databases.RemoveInstance(monitoredDatabase);
                    monitoredDatabase.StopMonitoring();
                }
            }
            ExTraceGlobals.MonitoredDatabaseTracer.TraceDebug(0L, "StopMonitoring:complete");
        }
コード例 #2
0
        // Token: 0x06002397 RID: 9111 RVA: 0x000A6BF8 File Offset: 0x000A4DF8
        public static bool StartListening(bool useExchangeSid = true)
        {
            ExTraceGlobals.MonitoredDatabaseTracer.TraceDebug(0L, "Network TCP listener start listening.");
            bool result;

            lock (RemoteDataProvider.s_singletonLock)
            {
                if (RemoteDataProvider.s_initialized)
                {
                    ExTraceGlobals.MonitoredDatabaseTracer.TraceDebug(0L, "StartListening returned because it is already initialized");
                    result = RemoteDataProvider.s_initialized;
                }
                else if (ThirdPartyManager.IsInitialized && ThirdPartyManager.IsThirdPartyReplicationEnabled)
                {
                    RemoteDataProvider.s_tprEnabled = true;
                    ExTraceGlobals.MonitoredDatabaseTracer.TraceDebug(0L, "StartListening does nothing because TPR is enabled");
                    result = true;
                }
                else
                {
                    RemoteDataProvider.s_tprEnabled = false;
                    if (RemoteDataProvider.s_selfCheckTimer == null)
                    {
                        RemoteDataProvider.s_selfCheckTimer = new Timer(new TimerCallback(RemoteDataProvider.SelfCheck), null, RegistryParameters.RemoteDataProviderSelfCheckInterval, RegistryParameters.RemoteDataProviderSelfCheckInterval);
                    }
                    try
                    {
                        if (useExchangeSid)
                        {
                            RemoteDataProvider.s_exchangeGroupSid = ObjectSecurity.ExchangeServersUsgSid;
                        }
                        if (RemoteDataProvider.s_tcpListener == null)
                        {
                            TcpListener.Config config = new TcpListener.Config();
                            config.ListenPort            = (int)NetworkManager.GetReplicationPort();
                            config.LocalNodeName         = Environment.MachineName;
                            config.AuthConnectionHandOff = new TcpListener.AuthenticatedConnectionHandler(NetworkChannel.ServiceRequests);
                            TcpListener tcpListener = new TcpListener();
                            Exception   ex          = tcpListener.StartListening(config);
                            if (ex != null)
                            {
                                ReplayEventLogConstants.Tuple_TcpListenerFailedToStart.LogEvent(null, new object[]
                                {
                                    ex
                                });
                                ExTraceGlobals.MonitoredDatabaseTracer.TraceError <Exception>(0L, "Network TCP listener could not be started: {0}", ex);
                                return(false);
                            }
                            RemoteDataProvider.s_tcpListener = tcpListener;
                        }
                        ClusterBatchWriter.Start();
                        RemoteDataProvider.s_initialized = true;
                        ExTraceGlobals.MonitoredDatabaseTracer.TraceDebug(0L, "Network TCP listener successfully activated");
                    }
                    catch (ADTransientException ex2)
                    {
                        ReplayEventLogConstants.Tuple_TcpListenerFailedToStart.LogEvent(null, new object[]
                        {
                            ex2
                        });
                    }
                    catch (ADExternalException ex3)
                    {
                        ReplayEventLogConstants.Tuple_TcpListenerFailedToStart.LogEvent(null, new object[]
                        {
                            ex3
                        });
                    }
                    catch (ADOperationException ex4)
                    {
                        ReplayEventLogConstants.Tuple_TcpListenerFailedToStart.LogEvent(null, new object[]
                        {
                            ex4
                        });
                    }
                    finally
                    {
                        if (!RemoteDataProvider.s_initialized)
                        {
                            ClusterBatchWriter.Stop();
                        }
                    }
                    result = RemoteDataProvider.s_initialized;
                }
            }
            return(result);
        }