コード例 #1
0
        /// <summary>
        ///     Provides the functionality for this thread.
        /// </summary>
        protected override void EntryPoint()
        {
            Logger.Info("Starting new arbitrator on thread #{0}.", LoggerVerboseLevel.High, Thread.CurrentThread.ManagedThreadId);

            m_service = new ArbitratorService(m_settings);
            m_service.Initialize();

            // Calculate when our life is over.
            m_lifeOverTimer = Environment.TickCount + RandomHelper.RandomInstance.Next(m_settings.ArbitratorLifetimeMin, m_settings.ArbitratorLifetimeMax);

            // Keep running until the service finishes or we are aborted.
            while (m_aborting == false)
            {
                // Are we out of time?
                if (Environment.TickCount > m_lifeOverTimer)
                {
                    break;
                }

                m_service.Poll();

                Thread.Sleep(50);
            }

            // Abort the service.
            m_service.Deinitialize();
        }
コード例 #2
0
        private int m_zoneID = 0; // Which zone we are currently in.

        #endregion Fields

        #region Constructors

        /// <summary>
        ///     Constructs a new instance of this class.
        /// </summary>
        /// <param name="arbitrator">Arbitrator that this peer is connected to.</param>
        /// <param name="peer_connection">Connection through which this peer is connected.</param>
        public ArbitratorPeer(ArbitratorService arbitrator, Connection peer_connection)
        {
            m_arbitrator = arbitrator;
            m_connection = peer_connection;
        }