From a49bf81ff29d9e31112cd8efe8da71ee4078f67c Mon Sep 17 00:00:00 2001 From: ed Date: Tue, 10 Dec 2024 00:36:58 +0000 Subject: [PATCH] mdns: improve nic-ip changelog if a NIC is brought up with several IPs, it would only mention one of the new IPs in the logs or if a PCIe bus crashes and all NICs drop dead, it would only mention one of the IPs that disappeared as both scenarios are oddly common, be more verbose --- copyparty/tcpsrv.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/copyparty/tcpsrv.py b/copyparty/tcpsrv.py index 23121793..256b9394 100644 --- a/copyparty/tcpsrv.py +++ b/copyparty/tcpsrv.py @@ -402,17 +402,17 @@ class TcpSrv(object): if not netdevs: continue - added = "nothing" - removed = "nothing" + add = [] + rem = [] for k, v in netdevs.items(): if k not in self.netdevs: - added = "{} = {}".format(k, v) + add.append("\n added %s = %s" % (k, v)) for k, v in self.netdevs.items(): if k not in netdevs: - removed = "{} = {}".format(k, v) + rem.append("\nremoved %s = %s" % (k, v)) - t = "network change detected:\n added {}\033[0;33m\nremoved {}" - self.log("tcpsrv", t.format(added, removed), 3) + t = "network change detected:\033[32m%s\033[33m%s" + self.log("tcpsrv", t % ("".join(add), "".join(rem)), 3) self.netdevs = netdevs self._distribute_netdevs()