2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-09-13 20:43:19 +00:00
This commit is contained in:
2020-02-26 03:14:22 +03:00
parent 7a21f6a928
commit fde1b1d8ad
39 changed files with 1108 additions and 502 deletions

View File

@@ -311,24 +311,26 @@ namespace Esyur.Net.Sockets
OnDestroy?.Invoke(this);
}
public AsyncReply<ISocket> Accept()
public async AsyncReply<ISocket> AcceptAsync()
{
var reply = new AsyncReply<ISocket>();
//var reply = new AsyncReply<ISocket>();
try
{
sock.AcceptAsync().ContinueWith((x) =>
{
try
{
reply.Trigger(new SSLSocket(x.Result, cert, true));
}
catch
{
reply.Trigger(null);
}
return new SSLSocket(await sock.AcceptAsync(), cert, true);
}, null);
//sock.AcceptAsync().ContinueWith((x) =>
//{
// try
// {
// reply.Trigger(new SSLSocket(x.Result, cert, true));
// }
// catch
// {
// reply.Trigger(null);
// }
//}, null);
}
catch
@@ -337,7 +339,7 @@ namespace Esyur.Net.Sockets
return null;
}
return reply;
//return reply;
}
public void Hold()
@@ -354,5 +356,18 @@ namespace Esyur.Net.Sockets
{
throw new NotImplementedException();
}
public ISocket Accept()
{
try
{
return new SSLSocket(sock.Accept(), cert, true);
}
catch
{
state = SocketState.Terminated;
return null;
}
}
}
}