Skip to content

Commit

Permalink
mdns: improve nic-ip changelog
Browse files Browse the repository at this point in the history
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
  • Loading branch information
9001 committed Dec 10, 2024
1 parent 64501fd commit a49bf81
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions copyparty/tcpsrv.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,17 +402,17 @@ def netmon(self):
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()

Expand Down

0 comments on commit a49bf81

Please sign in to comment.