mirror of
https://github.com/FastTunnel/FastTunnel.git
synced 2025-02-08 02:39:29 +08:00
Merge branch 'master' of https://github.com/SpringHgui/FastTunnel
# Conflicts: # FastTunnel.Core/AsyncListener.cs # FastTunnel.Server/appsettings.json
This commit is contained in:
commit
81f138a8c3
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user