Reduced the memory usage, as well as hopefully fixing the memory leak. Also implemented database compression across rows, including Brotli compression and bitshifting.

This commit is contained in:
2025-04-05 11:28:54 +02:00
parent b0318b7759
commit c7fcc3297f
9 changed files with 103 additions and 145 deletions
+14 -10
View File
@@ -145,12 +145,12 @@ public class IpScanner
if (i == 192 && k == 2) continue;
if (i == 192 && j == 88 && k == 99) continue;
if (_discardedQueue.Count >= 2000)
if (_discardedQueue.Count >= 20_000)
{
Thread.Sleep(1000);
}
if (_preFilteredQueue.Count >= 2000)
if (_preFilteredQueue.Count >= 20_000)
{
Thread.Sleep(1000);
}
@@ -170,7 +170,9 @@ public class IpScanner
resumeObject.FourthByte = l;
break;
}
Ip ip = new()
{
Ip1 = i,
@@ -186,19 +188,21 @@ public class IpScanner
// Sometimes, if the pinger gets a Destination Unreachable Communication administratively prohibited response, the pinger will throw an exception.
// https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol?useskin=vector#Control_messages
//_ = IPAddress.TryParse(ip.ToString(), out IPAddress? address);
if (i % 2 == 0)
responseCode = CustomPing.SendIcmpEchoRequestOverRawSocket(Parse(ip.ToString()), _timeout);
/*if (l % 2 == 0)
{
responseCode = IPStatus.Success;
}
else
{
responseCode = IPStatus.TimedOut;
}
}*/
//CustomPing.SendIcmpEchoRequestOverRawSocket(Parse(ip.ToString()), _timeout);
Thread.Sleep(16);
//responseCode = IPStatus.TimedOut;
//Thread.Sleep(0);
}
catch
{
@@ -233,10 +237,10 @@ public class IpScanner
resumeObject.FirstByte = i;
break;
}
Console.WriteLine($"Thread ({scanSettings.ThreadNumber}) is at index ({i}) out of ({scanSettings.End}). Remaining ({scanSettings.End - i})");
}
Console.WriteLine($"Thread ({scanSettings.ThreadNumber}) stopped.");
if (_stop)
{
resumeObject.Paused = true;
+6 -3
View File
@@ -15,8 +15,8 @@ public class ThreadHandler
private bool _contentFilterStopped;
private bool _ipFilterStopped;
private bool _stage1;
private bool _stage2 = true;
private bool _stage1 = true;
private bool _stage2;
private bool _stage3;
ConcurrentQueue<Filtered> filteredQueue = new();
@@ -54,10 +54,12 @@ public class ThreadHandler
prefilterDb.Start(); // de-queues from preFilteredQueue
scanner.Start(); // en-queues to discardedQueue and preFilteredQueue
resume.Start(); // de-queues from resumeQueue
scanner.Join();
Stop();
discarded.Join();
prefilterDb.Join();
scanner.Join();
resume.Join();
}
@@ -205,6 +207,7 @@ public class ThreadHandler
Console.WriteLine("Stopping Super Extra...");
_dbHandler.Stop();
Console.WriteLine("Stopped.");
}
}