Beispiel #1
0
 //====================================
 // internal implementation
 //====================================
 private void PrepareDirectoryChannel()
 {
     if (_directory != null)
     {
         _directoryChannel?.Close();
         _directoryChannel = new SocketChannelWriter(_testAddress ?? _directory.ToAddress(), Logger);
     }
     else
     {
         Logger.Debug($"DIRECTORY CLIENT [{_id}]: Cannot initialize the socket because directory is null.");
     }
 }
        //====================================
        // internal implementation
        //====================================

        private void ManageDirectoryChannel(string maybePublisherAvailability)
        {
            var publisherAvailability = PublisherAvailability.From(maybePublisherAvailability);

            if (publisherAvailability.IsValid)
            {
                if (!publisherAvailability.Equals(_directory !))
                {
                    _directory = publisherAvailability;
                    _directoryChannel?.Close();
                    _directoryChannel = new SocketChannelWriter(_testAddress ?? _directory.ToAddress(), Logger);
                }
            }
        }
 public void Dispose()
 {
     _channelWriter.Close();
     _channelReader.Close();
 }