Code cleanup for network module.
This commit is contained in:
@@ -2,6 +2,7 @@ using Org.BouncyCastle.Security;
|
||||
using Org.BouncyCastle.Tls;
|
||||
using Org.BouncyCastle.Tls.Crypto;
|
||||
using Org.BouncyCastle.Tls.Crypto.Impl.BC;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -9,7 +10,7 @@ using System.Text;
|
||||
using BcTlsClient = Org.BouncyCastle.Tls.TlsClient;
|
||||
|
||||
namespace Cryville.Common.Network {
|
||||
public class TlsClient {
|
||||
public class TlsClient : IDisposable {
|
||||
readonly TlsClientProtocol _protocol;
|
||||
readonly BcTlsClient _tlsClient;
|
||||
public Stream Stream { get; private set; }
|
||||
@@ -27,6 +28,16 @@ namespace Cryville.Common.Network {
|
||||
_protocol.Close();
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
public virtual void Dispose(bool disposing) {
|
||||
if (disposing) {
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTlsClient : DefaultTlsClient {
|
||||
readonly string _host;
|
||||
|
||||
|
Reference in New Issue
Block a user