# Conflicts:
#	FastTunnel.Core/AsyncListener.cs
#	FastTunnel.Server/appsettings.json
This commit is contained in:
SpringHgui 2020-09-18 18:30:05 +08:00
commit 81f138a8c3

View File

@ -46,31 +46,6 @@ namespace FastTunnel.Core
// post accepts on the listening socket
StartAccept(null);
//Task.Run(() =>
//{
// try
// {
// listenSocket.Listen(100);
// while (true)
// {
// // Set the event to nonsignaled state.
// allDone.Reset();
// // Start an asynchronous socket to listen for connections.
// _logerr.LogDebug($"Waiting for a connection {listenSocket.Handle}");
// listenSocket.BeginAccept(new AsyncCallback(AcceptCallback), listenSocket);
// // Wait until a connection is made before continuing.
// allDone.WaitOne();
// }
// }
// catch (Exception e)
// {
// Console.WriteLine(e.ToString());
// }
//});
}
public void StartAccept(SocketAsyncEventArgs acceptEventArg)
@ -114,21 +89,6 @@ namespace FastTunnel.Core
ProcessAccept(e);
}
void AcceptCallback(IAsyncResult ar)
{
if (Shutdown)
return;
// Signal the main thread to continue.
allDone.Set();
// Get the socket that handles the client request.
Socket listener = (Socket)ar.AsyncState;
Socket handler = listener.EndAccept(ar);
receiveClient.Invoke(handler);
}
public void ShutdownAndClose()
{
Shutdown = true;