Exemplo n.º 1
0
        /// <summary>
        /// Resets <see cref="TransportProvider{T}"/>.
        /// </summary>
        public void Reset()
        {
            ReceiveBuffer = null;
            SendBuffer    = null;

            BytesReceived = -1;

            // Reset the statistics.
            Statistics.Reset();

            // Cleanup the provider.
            try
            {
                if (Provider is IDisposable provider)
                {
                    provider.Dispose();
                }
            }
            catch (Exception ex)
            {
                // Ignore encountered exception during dispose.
                LibraryEvents.OnSuppressedException(this, ex);
            }
            finally
            {
                Provider = default !;