This commit is contained in:
SpringHgui 2020-10-28 09:44:02 +08:00
parent e21b09edf0
commit 7c90e04489
4 changed files with 19 additions and 11 deletions

View File

@ -38,8 +38,8 @@
"SSH": [
{
"LocalIp": "127.0.0.1",
"LocalPort": 22,
"RemotePort": 1273
"LocalPort": 88,
"RemotePort": 9999
},
{
"LocalIp": "192.168.0.91",

View File

@ -42,7 +42,6 @@ namespace FastTunnel.Core
listenSocket.Listen(100);
// post accepts on the listening socket
StartAccept(null);
}
@ -68,16 +67,23 @@ namespace FastTunnel.Core
private void ProcessAccept(SocketAsyncEventArgs e)
{
Interlocked.Increment(ref m_numConnectedSockets);
Console.WriteLine("Client connection accepted. There are {0} clients connected to the server",
m_numConnectedSockets);
if (e.SocketError == SocketError.Success)
{
var accept = e.AcceptSocket;
var accept = e.AcceptSocket;
Interlocked.Increment(ref m_numConnectedSockets);
_logerr.LogInformation($"【{IP}:{Port}】Accepted. There are {{0}} clients connected to the port",
m_numConnectedSockets);
// Accept the next connection request
StartAccept(e);
// Accept the next connection request
StartAccept(e);
_requestDispatcher.Dispatch(accept);
_requestDispatcher.Dispatch(accept);
}
else
{
ShutdownAndClose();
}
}
private void AcceptEventArg_Completed(object sender, SocketAsyncEventArgs e)
@ -97,6 +103,7 @@ namespace FastTunnel.Core
finally
{
listenSocket.Close();
Interlocked.Decrement(ref m_numConnectedSockets);
}
}
}

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Net.Sockets;
using System.Runtime.ExceptionServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@ -52,6 +53,7 @@ namespace FastTunnel.Core
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
ExceptionDispatchInfo.Capture(ex).Throw();
}
});
}

View File

@ -87,7 +87,6 @@ namespace FastTunnel.Core.Handlers
{
// cant use WebDomain
_logger.LogDebug($"USE WebDomain IN WWW {www}");
sb.Append($"{Environment.NewLine} cant use {www}");
}
}
}