Example #1
0
 public void Dispose()
 {
     try
     {
         if (Interlocked.CompareExchange(ref _connecting, 1, 0) == 1)
         {
             _client.Close();
             _client.Abort();
             _client.Dispose();
         }
     }
     catch (Exception ex)
     {
         _logger.LogCritical(ex.ToString());
     }
     finally
     {
         _connecting = 0;
         _client     = null;
     }
 }