chiark / gitweb /
mon/tripemon.in: Update peer IP address displays when the address changes.
authorMark Wooding <mdw@distorted.org.uk>
Wed, 6 Sep 2017 20:22:04 +0000 (21:22 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Thu, 14 Jun 2018 09:34:25 +0000 (10:34 +0100)
This affects both the main MonitorWindow and individual PeerWindows.

mon/tripemon.in

index d96601fbf56c9bb37e3a7c945afed4ed05d1f1d3..15fff2c8c3816ce8583cfbd92202d93a34ea05c7 100644 (file)
@@ -1364,6 +1364,7 @@ class PeerWindow (TrivialWindow):
   def change(me):
     """Update the display in response to a notification."""
     me.e['Interface'].set_text(me.peer.ifname)
+    me.e['Address'].set_text(me.peer.addr)
 
   def _update(me):
     """
@@ -1615,6 +1616,7 @@ class MonitorWindow (MyWindow):
                                   '???', 'green', '???', 'green'])
     peer.win = WindowSlot(lambda: PeerWindow(peer))
     me.hook(peer.pinghook, me._ping)
+    me.hook(peer.changehook, lambda: me._change(peer))
     me.apchange()
 
   def delpeer(me, peer):
@@ -1755,6 +1757,10 @@ class MonitorWindow (MyWindow):
       me.listmodel[p.i][textcol] = '%.1f ms' % ps.tlast
       me.listmodel[p.i][colourcol] = 'black'
 
+  def _change(me, p):
+    """Hook: notified when the peer changes state."""
+    me.listmodel[p.i][1] = p.addr
+
   def setstatus(me, status):
     """Update the message in the status bar."""
     me.status.pop(0)