后台打洞测试

This commit is contained in:
snltty
2024-09-17 14:28:41 +08:00
parent 70e3c26e4a
commit 1f0a4812de
3 changed files with 6 additions and 4 deletions

View File

@@ -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;

View File

@@ -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
{

View File

@@ -1,4 +1,4 @@
v1.3.8
2024-09-17 14:06:57
2024-09-17 14:28:41
1. 优化隧道连接逻辑,先中继,成功则后台打洞,失败则立即打洞
2. 测试中,请勿更新