зеркало из https://github.com/mono/mono-tls.git
We only need the interface.
This commit is contained in:
Родитель
de1f24dfa9
Коммит
cb7a817f19
|
@ -5,7 +5,7 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace Mono.Security.NewTls.TestFramework
|
||||
{
|
||||
public abstract class ClientAndServerHandler : ConnectionHandler
|
||||
public abstract class ClientAndServerHandler : IConnectionHandler
|
||||
{
|
||||
public IServer Server {
|
||||
get;
|
||||
|
@ -23,11 +23,11 @@ namespace Mono.Security.NewTls.TestFramework
|
|||
Client = client;
|
||||
}
|
||||
|
||||
public override bool SupportsCleanShutdown {
|
||||
public bool SupportsCleanShutdown {
|
||||
get { return Server.SupportsCleanShutdown && Client.SupportsCleanShutdown; }
|
||||
}
|
||||
|
||||
public override Task Run ()
|
||||
public Task Run ()
|
||||
{
|
||||
var serverWrapper = new StreamWrapper (Server.Stream);
|
||||
var clientWrapper = new StreamWrapper (Client.Stream);
|
||||
|
@ -36,7 +36,7 @@ namespace Mono.Security.NewTls.TestFramework
|
|||
|
||||
protected abstract Task MainLoop (ILineBasedStream serverStream, ILineBasedStream clientStream);
|
||||
|
||||
public override async Task<bool> Shutdown (bool attemptCleanShutdown, bool waitForReply)
|
||||
public async Task<bool> Shutdown (bool attemptCleanShutdown, bool waitForReply)
|
||||
{
|
||||
var clientShutdown = Client.Shutdown (attemptCleanShutdown, waitForReply);
|
||||
var serverShutdown = Server.Shutdown (attemptCleanShutdown, waitForReply);
|
||||
|
@ -44,7 +44,7 @@ namespace Mono.Security.NewTls.TestFramework
|
|||
return clientShutdown.Result && serverShutdown.Result;
|
||||
}
|
||||
|
||||
public override void Close ()
|
||||
public void Close ()
|
||||
{
|
||||
Client.Dispose ();
|
||||
Server.Dispose ();
|
||||
|
|
|
@ -5,7 +5,7 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace Mono.Security.NewTls.TestFramework
|
||||
{
|
||||
public abstract class CommonConnectionHandler : ConnectionHandler
|
||||
public abstract class CommonConnectionHandler : IConnectionHandler
|
||||
{
|
||||
public ICommonConnection Connection {
|
||||
get;
|
||||
|
@ -17,11 +17,11 @@ namespace Mono.Security.NewTls.TestFramework
|
|||
Connection = connection;
|
||||
}
|
||||
|
||||
public override bool SupportsCleanShutdown {
|
||||
public bool SupportsCleanShutdown {
|
||||
get { return Connection.SupportsCleanShutdown; }
|
||||
}
|
||||
|
||||
public override Task Run ()
|
||||
public Task Run ()
|
||||
{
|
||||
var wrapper = new StreamWrapper (Connection.Stream);
|
||||
return MainLoop (wrapper);
|
||||
|
@ -29,12 +29,12 @@ namespace Mono.Security.NewTls.TestFramework
|
|||
|
||||
protected abstract Task MainLoop (ILineBasedStream stream);
|
||||
|
||||
public override Task<bool> Shutdown (bool attemptCleanShutdown, bool waitForReply)
|
||||
public Task<bool> Shutdown (bool attemptCleanShutdown, bool waitForReply)
|
||||
{
|
||||
return Connection.Shutdown (attemptCleanShutdown, waitForReply);
|
||||
}
|
||||
|
||||
public override void Close ()
|
||||
public void Close ()
|
||||
{
|
||||
Connection.Dispose ();
|
||||
}
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Mono.Security.NewTls.TestFramework
|
||||
{
|
||||
public abstract class ConnectionHandler
|
||||
{
|
||||
public abstract bool SupportsCleanShutdown {
|
||||
get;
|
||||
}
|
||||
|
||||
public abstract Task Run ();
|
||||
|
||||
public abstract Task<bool> Shutdown (bool attemptCleanShutdown, bool waitForReply);
|
||||
|
||||
public abstract void Close ();
|
||||
}
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@ namespace Mono.Security.NewTls.TestFramework
|
|||
{
|
||||
public abstract class ConnectionHandlerFactory
|
||||
{
|
||||
public abstract ConnectionHandler Create (IConnection connection);
|
||||
public abstract IConnectionHandler Create (IConnection connection);
|
||||
|
||||
public static readonly ConnectionHandlerFactory OkAndDone = new SimpleFactory (c => new OkAndDoneHandler (c));
|
||||
|
||||
|
@ -16,7 +16,7 @@ namespace Mono.Security.NewTls.TestFramework
|
|||
|
||||
public static readonly ConnectionHandlerFactory HandshakeAndDone = new SimpleFactory (c => new HandshakeAndDoneHandler ((IClientAndServer)c));
|
||||
|
||||
delegate ConnectionHandler FactoryDelegate (IConnection connection);
|
||||
delegate IConnectionHandler FactoryDelegate (IConnection connection);
|
||||
|
||||
class SimpleFactory : ConnectionHandlerFactory
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ namespace Mono.Security.NewTls.TestFramework
|
|||
this.func = func;
|
||||
}
|
||||
|
||||
public override ConnectionHandler Create (IConnection connection)
|
||||
public override IConnectionHandler Create (IConnection connection)
|
||||
{
|
||||
return func (connection);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,15 @@ namespace Mono.Security.NewTls.TestFramework
|
|||
{
|
||||
public interface IConnectionHandler
|
||||
{
|
||||
bool SupportsCleanShutdown {
|
||||
get;
|
||||
}
|
||||
|
||||
Task Run ();
|
||||
|
||||
Task<bool> Shutdown (bool attemptCleanShutdown, bool waitForReply);
|
||||
|
||||
void Close ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,6 @@
|
|||
<Compile Include="IClientAndServer.cs" />
|
||||
<Compile Include="ClientAndServerHandler.cs" />
|
||||
<Compile Include="CommonConnectionHandler.cs" />
|
||||
<Compile Include="ConnectionHandler.cs" />
|
||||
<Compile Include="ConnectionHandlerFactory.cs" />
|
||||
<Compile Include="ConnectionException.cs" />
|
||||
<Compile Include="DependencyInjector.cs" />
|
||||
|
|
Загрузка…
Ссылка в новой задаче