Fixed duplicate insertions into the filtered database.

This commit is contained in:
2024-11-27 15:53:00 +01:00
parent 7ad691c439
commit f02203c14c
9 changed files with 39 additions and 18 deletions
+6 -7
View File
@@ -1,6 +1,5 @@
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Text;
using Backend.Helper;
using Models.Handler;
using Models.Model.Backend;
@@ -15,18 +14,18 @@ public class ContentFilter
private readonly string _getDomainPort443;
private bool _stop;
private int _timeOut;
private string _basePath;
private readonly string _basePath;
public ContentFilter(ConcurrentQueue<QueueItem> queue, DbHandler dbHandler, string basePath)
{
_queue = queue;
_dbHandler = dbHandler;
_basePath = basePath;
_getDomainPort80 = $"{basePath}/Backend/Scripts/GetDomainNamePort80.sh";
_getDomainPort443 = $"{basePath}/Backend/Scripts/GetDomainNamePort443.sh";
SetTimeout(60000);
SetTimeout(3000);
}
public void SetTimeout(int timeOut)
@@ -39,6 +38,7 @@ public class ContentFilter
WaitHandle[] waitHandles = new WaitHandle[1];
EventWaitHandle handle = new(false, EventResetMode.ManualReset);
waitHandles[0] = handle;
Thread f = new (Filter!);
f.Start(handle);
@@ -229,12 +229,11 @@ public class ContentFilter
Process proc = new();
proc.StartInfo = new()
{
FileName = fileName,
Arguments = $"{ip}",
FileName = "/bin/bash",
Arguments = $"{fileName} {ip} {_basePath}/Backend/Scripts/{port}Header.txt",
UseShellExecute = false,
RedirectStandardOutput = false,
RedirectStandardError = false,
RedirectStandardInput = false,
CreateNoWindow = true
};
+2 -2
View File
@@ -51,7 +51,7 @@ public class ThreadHandler
{
Thread.Sleep(10000); // Let the database handler instantiate and warm up first.
WaitHandle[] wait = _ipScanner.Start(2);
WaitHandle[] wait = _ipScanner.Start(64);
WaitHandle.WaitAll(wait);
@@ -78,7 +78,7 @@ public class ThreadHandler
private void StartDiscardedDbHandler()
{
WaitHandle[] wait = _dbHandler.Start(2);
WaitHandle[] wait = _dbHandler.Start(4);
WaitHandle.WaitAll(wait);