Esempio n. 1
0
 /// <summary>
 ///     Dispose resources
 /// </summary>
 public void Dispose()
 {
     _actor?.Dispose();
     _connectionDisposable?.Dispose();
     _reqSocket?.Dispose();
     _disposables?.Dispose();
 }
Esempio n. 2
0
 public void Dispose()
 {
     lock (m_actor)
     {
         m_actor.Dispose();
     }
 }
Esempio n. 3
0
        public void Dispose()
        {
            m_actor.Dispose();

            m_messagesPipe.Options.Linger = TimeSpan.Zero;
            m_messagesPipe.Dispose();
        }
 private bool _disposedValue; // To detect redundant calls
 /// <summary>
 /// Releases unmanaged and - optionally - managed resources.
 /// </summary>
 /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
 protected virtual void Dispose(bool disposing)
 {
     if (!_disposedValue)
     {
         if (disposing)
         {
             _stopRequested = true;
             try
             {
                 lock (_lockSocket)
                 {
                     _actor?.Dispose();
                 }
             }
             catch (SocketException error)
             {
                 if (error.ErrorCode == 10035 || error.ErrorCode == 10054) //ignore socket close errors when exiting
                 {
                     return;
                 }
                 throw;
             }
             while (_running)
             {
                 Thread.Sleep(100);
             }
         }
         _disposedValue = true;
     }
 }
Esempio n. 5
0
        /// <summary>
        ///
        /// </summary>
        private void ServerLoop()
        {
            if (Thread.CurrentThread.Name == null)
            {
                Thread.CurrentThread.Name = "Nyx Hub Server Loop";
            }

            _disposables.Add(NyxMessageStream.Subscribe(RepSocketOnReceiveReady, x => _logger.Error("Error processing stream.", x)));
            _hubActor?.Dispose();
            _hubActor = NetMQActor.Create(new HubShimHandler(_inMessage, Port));

            _logger.Debug("Starting hub server loop...");
            _isStarted = true;
            _plugman.StartAllPlugins();
            _nodeStatusSubject.OnNext(NyxNodeStatus.Started);
            // Endless loop until request to stop, then shutdowns
            while (!_serverCancelToken.IsCancellationRequested)
            {
                _serverEvent.WaitOne(TimeSpan.FromSeconds(60));
            }
            _plugman.StopAllPlugins();
            Status = NyxNodeStatus.Stopped;
            _nodeStatusSubject.OnNext(Status);
            try
            {
                _hubActor?.SendFrame(NetMQActor.EndShimMessage);
                _hubActor?.Dispose();
            }
            catch (TerminatingException)
            {
                // Ignore and go
            }
            _isStarted = false;
        }
Esempio n. 6
0
 public void Stop()
 {
     if (actor != null)
     {
         actor.Dispose();
         actor = null;
     }
 }
Esempio n. 7
0
 public void Stop()
 {
     if (_actor != null)
     {
         _actor.Dispose();
         _actor = null;
     }
 }
Esempio n. 8
0
 public void Dispose()
 {
     lock (m_actor)
     {
         m_actor.Dispose();
         m_outgoingQueue.Dispose();
     }
 }
Esempio n. 9
0
 public void Dispose()
 {
     lock (m_actor)
     {
         m_actor.Dispose();
         disposed = true;
     }
 }
Esempio n. 10
0
 public void Dispose()
 {
     _actor?.Dispose();
     _publisher?.Dispose();
     _subscriber?.Dispose();
     _beacon?.Dispose();
     _poll?.Dispose();
     _shim?.Dispose();
 }
Esempio n. 11
0
 /// <summary>
 ///     Init or reinit all communications.
 /// </summary>
 public void Init()
 {
     if (Interlocked.CompareExchange(ref _requiresInitialisation, 0, 1) == 0)
     {
         return;
     }
     _actor?.SendFrame(NetMQActor.EndShimMessage);
     _actor?.Dispose();
     _actor = NetMQActor.Create(new ShimHandler(this, _connectionSubject, _address, _port));
 }
Esempio n. 12
0
 /// <summary>
 /// 析构
 /// </summary>
 public void Dispose()
 {
     if (IsDisposed)
     {
         return;
     }
     IsDisposed = true;
     ShimHandler.Close();
     Monitor.Enter(ShimHandler);
     Monitor.Exit(ShimHandler);
     _actor.Dispose();
     _messagesPipe.Options.Linger = TimeSpan.Zero;
     _messagesPipe.Dispose();
 }
Esempio n. 13
0
        /// <summary>
        /// Release any contained resources.
        /// </summary>
        /// <param name="disposing">true if managed resources are to be released</param>
        protected virtual void Dispose(bool disposing)
        {
            if (!disposing)
            {
                return;
            }

            Stop();
            if (_useEvents)
            {
                _inboxPoller?.StopAsync();
                _inboxPoller?.Dispose();
            }
            _actor?.Dispose();
            _inbox?.Dispose();
        }
Esempio n. 14
0
 public void Dispose()
 {
     _actor.Dispose();
 }
Esempio n. 15
0
 public void Dispose()
 {
     _poller.Stop();
     _actor.Dispose();
 }