mirror of
https://github.com/FastTunnel/FastTunnel.git
synced 2024-09-20 23:48:30 +08:00
issues #12
This commit is contained in:
parent
e21b09edf0
commit
7c90e04489
|
@ -38,8 +38,8 @@
|
||||||
"SSH": [
|
"SSH": [
|
||||||
{
|
{
|
||||||
"LocalIp": "127.0.0.1",
|
"LocalIp": "127.0.0.1",
|
||||||
"LocalPort": 22,
|
"LocalPort": 88,
|
||||||
"RemotePort": 1273
|
"RemotePort": 9999
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"LocalIp": "192.168.0.91",
|
"LocalIp": "192.168.0.91",
|
||||||
|
|
|
@ -42,7 +42,6 @@ namespace FastTunnel.Core
|
||||||
|
|
||||||
listenSocket.Listen(100);
|
listenSocket.Listen(100);
|
||||||
|
|
||||||
// post accepts on the listening socket
|
|
||||||
StartAccept(null);
|
StartAccept(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,16 +67,23 @@ namespace FastTunnel.Core
|
||||||
|
|
||||||
private void ProcessAccept(SocketAsyncEventArgs e)
|
private void ProcessAccept(SocketAsyncEventArgs e)
|
||||||
{
|
{
|
||||||
Interlocked.Increment(ref m_numConnectedSockets);
|
if (e.SocketError == SocketError.Success)
|
||||||
Console.WriteLine("Client connection accepted. There are {0} clients connected to the server",
|
{
|
||||||
m_numConnectedSockets);
|
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
|
// Accept the next connection request
|
||||||
StartAccept(e);
|
StartAccept(e);
|
||||||
|
|
||||||
_requestDispatcher.Dispatch(accept);
|
_requestDispatcher.Dispatch(accept);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ShutdownAndClose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AcceptEventArg_Completed(object sender, SocketAsyncEventArgs e)
|
private void AcceptEventArg_Completed(object sender, SocketAsyncEventArgs e)
|
||||||
|
@ -97,6 +103,7 @@ namespace FastTunnel.Core
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
listenSocket.Close();
|
listenSocket.Close();
|
||||||
|
Interlocked.Decrement(ref m_numConnectedSockets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
|
using System.Runtime.ExceptionServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -52,6 +53,7 @@ namespace FastTunnel.Core
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine(ex.ToString());
|
Console.WriteLine(ex.ToString());
|
||||||
|
ExceptionDispatchInfo.Capture(ex).Throw();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,6 @@ namespace FastTunnel.Core.Handlers
|
||||||
{
|
{
|
||||||
// cant use WebDomain
|
// cant use WebDomain
|
||||||
_logger.LogDebug($"USE WebDomain IN WWW {www}");
|
_logger.LogDebug($"USE WebDomain IN WWW {www}");
|
||||||
sb.Append($"{Environment.NewLine} cant use {www}");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user