Fix server deduplicaiton failure

- Add a local method AreEquel to compare string values, return TRUE when compare between 'null' and 'string.Emtpy'
This commit is contained in:
averylynnn 2025-03-13 09:02:06 +08:00
parent 2df412476a
commit 005b532e7d

View file

@ -951,22 +951,27 @@ namespace ServiceLib.Handler
return false; return false;
} }
static bool AreEqual(string? a, string? b)
{
return string.Equals(a, b) || (string.IsNullOrEmpty(a) && string.IsNullOrEmpty(b));
}
return o.ConfigType == n.ConfigType return o.ConfigType == n.ConfigType
&& o.Address == n.Address && AreEqual(o.Address, n.Address)
&& o.Port == n.Port && o.Port == n.Port
&& o.Id == n.Id && AreEqual(o.Id, n.Id)
&& o.Security == n.Security && AreEqual(o.Security, n.Security)
&& o.Network == n.Network && AreEqual(o.Network, n.Network)
&& o.HeaderType == n.HeaderType && AreEqual(o.HeaderType, n.HeaderType)
&& o.RequestHost == n.RequestHost && AreEqual(o.RequestHost, n.RequestHost)
&& o.Path == n.Path && AreEqual(o.Path, n.Path)
&& (o.ConfigType == EConfigType.Trojan || o.StreamSecurity == n.StreamSecurity) && (o.ConfigType == EConfigType.Trojan || o.StreamSecurity == n.StreamSecurity)
&& o.Flow == n.Flow && AreEqual(o.Flow, n.Flow)
&& o.Sni == n.Sni && AreEqual(o.Sni, n.Sni)
&& o.Alpn == n.Alpn && AreEqual(o.Alpn, n.Alpn)
&& o.Fingerprint == n.Fingerprint && AreEqual(o.Fingerprint, n.Fingerprint)
&& o.PublicKey == n.PublicKey && AreEqual(o.PublicKey, n.PublicKey)
&& o.ShortId == n.ShortId && AreEqual(o.ShortId, n.ShortId)
&& (!remarks || o.Remarks == n.Remarks); && (!remarks || o.Remarks == n.Remarks);
} }