Fix communication between applications.
This commit is contained in:
@@ -43,6 +43,8 @@ public class Communication
|
||||
{
|
||||
using ResponseSocket rep = new();
|
||||
|
||||
//rep.Options.IPv4Only = true;
|
||||
|
||||
rep.Bind("tcp://127.0.0.1:5556");
|
||||
|
||||
while (_isRunning)
|
||||
@@ -51,6 +53,8 @@ public class Communication
|
||||
|
||||
CommunicationObject? communicationObject = JsonSerializer.Deserialize<CommunicationObject>(message);
|
||||
|
||||
rep.SendFrame(JsonSerializer.SerializeToUtf8Bytes("Success"));
|
||||
|
||||
if (communicationObject is null)
|
||||
{
|
||||
continue;
|
||||
@@ -134,12 +138,7 @@ public class Communication
|
||||
|
||||
case CommunicationCommand.ChangeRuntimeVariable:
|
||||
{
|
||||
Console.WriteLine("lmao");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(communicationObject.VariableValue))
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(communicationObject.VariableValue)) break;
|
||||
|
||||
if (communicationObject.Variable == RuntimeVariable.DbContent.ToString())
|
||||
{
|
||||
@@ -152,13 +151,13 @@ public class Communication
|
||||
int value = int.Parse(communicationObject.VariableValue);
|
||||
_dbHandler.SetDiscardedWaitTime(value);
|
||||
}
|
||||
|
||||
|
||||
if (communicationObject.Variable == RuntimeVariable.ScannerTimeout.ToString())
|
||||
{
|
||||
int value = int.Parse(communicationObject.VariableValue);
|
||||
_ipScanner.SetTimeout(value);
|
||||
}
|
||||
|
||||
|
||||
if (communicationObject.Variable == RuntimeVariable.ContentFilter.ToString())
|
||||
{
|
||||
int value = int.Parse(communicationObject.VariableValue);
|
||||
|
||||
@@ -25,8 +25,10 @@ public class ContentFilter
|
||||
|
||||
_getDomainPort80 = $"{basePath}/Backend/Scripts/GetDomainNamePort80.sh";
|
||||
_getDomainPort443 = $"{basePath}/Backend/Scripts/GetDomainNamePort443.sh";
|
||||
|
||||
SetTimeout(60000);
|
||||
}
|
||||
|
||||
|
||||
public void SetTimeout(int timeOut)
|
||||
{
|
||||
_timeOut = timeOut;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Concurrent;
|
||||
using System.Globalization;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using Backend.Helper;
|
||||
@@ -35,7 +34,6 @@ public class IpScanner
|
||||
|
||||
public void SetTimeout(int milliseconds)
|
||||
{
|
||||
Console.WriteLine($"Setting timeout to {milliseconds}ms");
|
||||
_timeout = milliseconds;
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ public class ThreadHandler
|
||||
|
||||
Stop();
|
||||
}
|
||||
|
||||
|
||||
private void Stop()
|
||||
{
|
||||
_ipScanner.Stop();
|
||||
|
||||
Reference in New Issue
Block a user