[tor-commits] [arm/release] fix: updating bandwidth graph on shutdown

atagar at torproject.org atagar at torproject.org
Sun Jul 17 06:08:21 UTC 2011


commit 3cfa3533d3ce1e2ac24b382bc310710c5e02ee00
Author: Damian Johnson <atagar at torproject.org>
Date:   Thu May 26 08:22:43 2011 -0700

    fix: updating bandwidth graph on shutdown
    
    If we have accounting and shut down Tor the accounting section should say
    "Connection Closed...". However, this wasn't happening unless we forced a
    redraw, such as by changing pages. This change makes the bandwidthStats
    initiate a redraw itself on controller status changes.
---
 src/cli/graphing/bandwidthStats.py |    4 ++++
 src/cli/graphing/graphPanel.py     |    2 +-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/cli/graphing/bandwidthStats.py b/src/cli/graphing/bandwidthStats.py
index d378c45..4e033f6 100644
--- a/src/cli/graphing/bandwidthStats.py
+++ b/src/cli/graphing/bandwidthStats.py
@@ -87,6 +87,10 @@ class BandwidthStats(graphPanel.GraphStats):
     
     if eventType == torTools.State.INIT and self._config["features.graph.bw.accounting.show"]:
       self.isAccounting = conn.getInfo('accounting/enabled') == '1'
+    
+    # redraws to reflect changes (this especially noticeable when we have
+    # accounting and shut down since it then gives notice of the shutdown)
+    if self._graphPanel and self.isSelected: self._graphPanel.redraw(True)
   
   def prepopulateFromState(self):
     """
diff --git a/src/cli/graphing/graphPanel.py b/src/cli/graphing/graphPanel.py
index b48f82b..5fa1262 100644
--- a/src/cli/graphing/graphPanel.py
+++ b/src/cli/graphing/graphPanel.py
@@ -221,7 +221,7 @@ class GraphStats(TorCtl.PostEventListener):
         self.secondaryCounts[i].insert(0, 0)
         del self.secondaryCounts[i][self.maxCol + 1:]
     
-    if isRedraw: self._graphPanel.redraw(True)
+    if isRedraw and self._graphPanel: self._graphPanel.redraw(True)
 
 class GraphPanel(panel.Panel):
   """





More information about the tor-commits mailing list