mirror of
https://github.com/cyanfish/naps2.git
synced 2024-09-17 10:47:11 +03:00
Escl: Add SearchTimeout option
This commit is contained in:
parent
962159b2d4
commit
ef64c4840d
@ -2,4 +2,8 @@
|
||||
|
||||
public class EsclOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// The maximum time (in ms) to search for ESCL devices when calling GetDevices or at the start of a scan.
|
||||
/// </summary>
|
||||
public int SearchTimeout { get; set; } = 5000;
|
||||
}
|
@ -56,7 +56,7 @@ internal class EsclScanDriver : IScanDriver
|
||||
locator.Start();
|
||||
try
|
||||
{
|
||||
await Task.Delay(2000, cancelToken);
|
||||
await Task.Delay(options.EsclOptions.SearchTimeout, cancelToken);
|
||||
}
|
||||
catch (TaskCanceledException)
|
||||
{
|
||||
@ -221,7 +221,7 @@ internal class EsclScanDriver : IScanDriver
|
||||
foundTcs.TrySetResult(service);
|
||||
}
|
||||
});
|
||||
Task.Delay(2000).ContinueWith(_ => foundTcs.TrySetResult(null)).AssertNoAwait();
|
||||
Task.Delay(options.EsclOptions.SearchTimeout).ContinueWith(_ => foundTcs.TrySetResult(null)).AssertNoAwait();
|
||||
locator.Logger = _scanningContext.Logger;
|
||||
locator.Start();
|
||||
return await foundTcs.Task;
|
||||
|
Loading…
Reference in New Issue
Block a user