mirror of
https://github.com/Stone-Red-Code/HyperbolicDownloader.git
synced 2026-09-07 07:46:22 +02:00
Add new log command and some general command improvments
This commit is contained in:
@@ -12,16 +12,7 @@ public class HostsManager
|
||||
|
||||
public int AddRange(IEnumerable<NetworkSocket> hosts)
|
||||
{
|
||||
int newHosts = 0;
|
||||
|
||||
foreach (NetworkSocket host in hosts)
|
||||
{
|
||||
if (Add(host))
|
||||
{
|
||||
newHosts++;
|
||||
}
|
||||
}
|
||||
|
||||
int newHosts = hosts.Count(Add);
|
||||
SaveHosts();
|
||||
|
||||
return newHosts;
|
||||
@@ -44,14 +35,14 @@ public class HostsManager
|
||||
{
|
||||
if (DateTime.Now - host.LastActive >= new TimeSpan(24, 0, 0) || forceRemove)
|
||||
{
|
||||
_ = hosts.RemoveAll(x => x.IPAddress == host.IPAddress && x.Port == host.Port);
|
||||
_ = hosts.RemoveAll(x => x.Equals(host));
|
||||
}
|
||||
SaveHosts();
|
||||
}
|
||||
|
||||
public bool Contains(NetworkSocket host)
|
||||
{
|
||||
return hosts.Any(x => x.IPAddress == host.IPAddress && x.Port == host.Port);
|
||||
return hosts.Exists(x => x.Equals(host));
|
||||
}
|
||||
|
||||
public int CheckHostsActivity()
|
||||
@@ -65,7 +56,7 @@ public class HostsManager
|
||||
|
||||
try
|
||||
{
|
||||
_ = tcpClient.ConnectAsync(host.IPAddress, host.Port).Wait(500);
|
||||
_ = tcpClient.ConnectAsync(host.IPAddress, host.Port).Wait(1000);
|
||||
Console.CursorLeft = 0;
|
||||
if (tcpClient.Connected)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user