feat: complete TASK-WP0-07 supervisor

This commit is contained in:
suyx
2026-07-27 23:28:36 +08:00
parent 2dd6f5c2c2
commit 096a1f1279
22 changed files with 1717 additions and 6 deletions
@@ -0,0 +1,21 @@
using System.Net;
using System.Net.Sockets;
namespace Dada.Supervisor;
internal static class LoopbackPortGuard
{
internal static SupervisorState Check()
{
try
{
using var listener = new TcpListener(IPAddress.Parse(LoopbackEndpoint.Host), LoopbackEndpoint.Port);
listener.Start();
return SupervisorState.Starting;
}
catch (SocketException)
{
return SupervisorState.PortInUse;
}
}
}