Implement autostart functionality, ZIP packaging, and related installation scripts; update documentation and tests
This commit is contained in:
@@ -11,6 +11,7 @@ internal sealed class MdnsPublisher(string fingerprint, int port) : IDisposable
|
||||
private ServiceProfile? profile;
|
||||
private string addressesKey = "";
|
||||
private DateTimeOffset nextAnnouncement;
|
||||
private DateTimeOffset lastRefresh;
|
||||
public string Status { get; private set; } = "mDNS: ожидание локальной сети.";
|
||||
|
||||
public static ServiceProfile CreateProfile(string fingerprint, int port, IPAddress[] addresses)
|
||||
@@ -28,6 +29,10 @@ internal sealed class MdnsPublisher(string fingerprint, int port) : IDisposable
|
||||
{
|
||||
try
|
||||
{
|
||||
// Rebind after a long pause (sleep/resume), even if Windows kept the same IP.
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
if (lastRefresh != default && (now - lastRefresh > TimeSpan.FromSeconds(20) || now < lastRefresh)) Stop();
|
||||
lastRefresh = now;
|
||||
var key = string.Join(",", addresses.Select(a => a.ToString()));
|
||||
if (discovery is null || key != addressesKey)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user