Testing search query
This commit is contained in:
@@ -32,7 +32,7 @@ public class IpScanner
|
||||
_discardedQueue = discardedQueue;
|
||||
_unfilteredQueue = unfilteredQueue;
|
||||
_resumeQueue = resumeQueue;
|
||||
|
||||
|
||||
SetTimeout(64);
|
||||
}
|
||||
|
||||
@@ -48,24 +48,12 @@ public class IpScanner
|
||||
{
|
||||
threadsAmount = 256 / threads;
|
||||
}
|
||||
|
||||
WaitHandle[] waitHandle1;
|
||||
WaitHandle[] waitHandle2;
|
||||
|
||||
// This is jank. But it was to get it production ready.
|
||||
if (threads <= 64)
|
||||
{
|
||||
waitHandle1 = new WaitHandle[threads];
|
||||
waitHandle2 = new WaitHandle[threads];
|
||||
}
|
||||
else
|
||||
{
|
||||
waitHandle1 = new WaitHandle[64];
|
||||
waitHandle2 = new WaitHandle[64];
|
||||
}
|
||||
|
||||
WaitHandle[] waitHandle = new WaitHandle[64];
|
||||
|
||||
int counter = 0;
|
||||
int counter2 = 0;
|
||||
|
||||
List<WaitHandle[]> waitHandles = [];
|
||||
|
||||
for (int i = 0; i < threads; i++)
|
||||
{
|
||||
@@ -79,32 +67,27 @@ public class IpScanner
|
||||
Handle = handle
|
||||
};
|
||||
|
||||
if (i < 64)
|
||||
if (counter < 64)
|
||||
{
|
||||
waitHandle1[counter] = handle;
|
||||
waitHandle[counter] = handle;
|
||||
counter++;
|
||||
}
|
||||
else
|
||||
{
|
||||
waitHandle2[counter2] = handle;
|
||||
counter2++;
|
||||
|
||||
Thread f = new (Scan!);
|
||||
f.Start(scanSettings);
|
||||
|
||||
Console.WriteLine($"Scanner thread ({i}) started");
|
||||
Thread.Sleep(100);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
Thread f = new (Scan!);
|
||||
f.Start(scanSettings);
|
||||
counter = 0;
|
||||
|
||||
Console.WriteLine($"Scanner thread ({i}) started");
|
||||
Thread.Sleep(100);
|
||||
waitHandles.Add(waitHandle);
|
||||
|
||||
waitHandle = new WaitHandle[64];
|
||||
}
|
||||
|
||||
List<WaitHandle[]> waitHandles = new();
|
||||
|
||||
Console.WriteLine("Waithandle 1 count = " + waitHandle1.Length);
|
||||
Console.WriteLine("Waithandle 2 count = " + waitHandle2.Length);
|
||||
|
||||
waitHandles.Add(waitHandle1);
|
||||
waitHandles.Add(waitHandle2);
|
||||
|
||||
return waitHandles;
|
||||
}
|
||||
|
||||
@@ -183,7 +166,8 @@ public class IpScanner
|
||||
_ = IPAddress.TryParse(ip.ToString(), out IPAddress? address);
|
||||
if (address is not null)
|
||||
{
|
||||
responseCode = ping.Send(address, _timeout, buf, null).Status;
|
||||
responseCode = IPStatus.TimedOut; //ping.Send(address, _timeout, buf, null).Status;
|
||||
Thread.Sleep(_timeout);
|
||||
}
|
||||
}
|
||||
catch
|
||||
|
||||
@@ -59,7 +59,7 @@ public class ThreadHandler
|
||||
{
|
||||
Thread.Sleep(5000); // Let the database handler instantiate and warm up first.
|
||||
|
||||
List<WaitHandle[]> wait = _ipScanner.Start(128);
|
||||
List<WaitHandle[]> wait = _ipScanner.Start(256);
|
||||
|
||||
for (int i = 0; i < wait.Count; i++)
|
||||
{
|
||||
@@ -101,7 +101,7 @@ public class ThreadHandler
|
||||
|
||||
private void StartDiscardedDbHandler()
|
||||
{
|
||||
WaitHandle[] wait = _dbHandler.Start(4);
|
||||
WaitHandle[] wait = _dbHandler.Start(5);
|
||||
|
||||
WaitHandle.WaitAll(wait);
|
||||
|
||||
|
||||
@@ -18,11 +18,25 @@ public static partial class HttpClientHelper
|
||||
|
||||
if (port == 80)
|
||||
{
|
||||
client.BaseAddress = new($"http://{url}");
|
||||
try
|
||||
{
|
||||
client.BaseAddress = new($"http://{url}");
|
||||
}
|
||||
catch
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
client.BaseAddress = new($"https://{url}");
|
||||
try
|
||||
{
|
||||
client.BaseAddress = new($"https://{url}");
|
||||
}
|
||||
catch
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
client.DefaultRequestHeaders.Accept.Clear();
|
||||
@@ -87,11 +101,25 @@ public static partial class HttpClientHelper
|
||||
|
||||
if (port == 80)
|
||||
{
|
||||
client.BaseAddress = new($"http://{url}");
|
||||
try
|
||||
{
|
||||
client.BaseAddress = new($"http://{url}");
|
||||
}
|
||||
catch
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
client.BaseAddress = new($"https://{url}");
|
||||
try
|
||||
{
|
||||
client.BaseAddress = new($"https://{url}");
|
||||
}
|
||||
catch
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
client.DefaultRequestHeaders.Accept.Clear();
|
||||
|
||||
Reference in New Issue
Block a user