mirror of
https://github.com/snltty/linker.git
synced 2025-11-02 23:44:00 +08:00
后台打洞测试
This commit is contained in:
@@ -426,7 +426,7 @@ namespace linker.tunnel
|
||||
/// </summary>
|
||||
/// <param name="remoteMachineId"></param>
|
||||
/// <param name="transactionId"></param>
|
||||
public void StartBackground(string remoteMachineId, string transactionId, TunnelProtocolType denyProtocols, Func<bool> stopCallback, int times = 10)
|
||||
public void StartBackground(string remoteMachineId, string transactionId, TunnelProtocolType denyProtocols, Func<bool> stopCallback, int times = 10,int delay = 10000)
|
||||
{
|
||||
if (AddBackground(remoteMachineId, transactionId) == false)
|
||||
{
|
||||
@@ -438,6 +438,8 @@ namespace linker.tunnel
|
||||
{
|
||||
try
|
||||
{
|
||||
await Task.Delay(delay);
|
||||
|
||||
for (int i = 1; i <= times; i++)
|
||||
{
|
||||
if (stopCallback()) break;
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace linker.plugins.tunnel
|
||||
Version.Add();
|
||||
Connected(connection);
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected virtual async ValueTask<bool> WaitAsync(string machineId)
|
||||
{
|
||||
@@ -121,7 +121,7 @@ namespace linker.plugins.tunnel
|
||||
tunnelTransfer.StartBackground(machineId, TransactionId, denyProtocols, () =>
|
||||
{
|
||||
return connections.TryGetValue(machineId, out ITunnelConnection connection) && connection.Connected && connection.Type == TunnelType.P2P;
|
||||
});
|
||||
}, 10, 30000);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
v1.3.8
|
||||
2024-09-17 14:06:57
|
||||
2024-09-17 14:28:41
|
||||
1. 优化隧道连接逻辑,先中继,成功则后台打洞,失败则立即打洞
|
||||
2. 测试中,请勿更新
|
||||
Reference in New Issue
Block a user