[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [arm/master] fix: config panel handling for reattachment



commit 487c6effbecc0e6415aa865547acce58f13e9c56
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sun Jun 19 14:14:55 2011 -0700

    fix: config panel handling for reattachment
    
    When arm's connected to a new tor instance the current config options are
    replaced with those of the new instance. This addresses a couple issues we
    previously had...
    
    1. if arm was initially detached then when connected to an instance the config
    panel would still be blank
    2. if tor was shut down and we were then reattached to a different version
    (with different config options) we'd still display the old set
---
 src/cli/configPanel.py |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/src/cli/configPanel.py b/src/cli/configPanel.py
index 913bc39..33cec34 100644
--- a/src/cli/configPanel.py
+++ b/src/cli/configPanel.py
@@ -190,6 +190,7 @@ class ConfigPanel(panel.Panel):
     
     self.configType = configType
     self.confContents = []
+    self.confImportantContents = []
     self.scroller = uiTools.Scroller(True)
     self.valsLock = threading.RLock()
     
@@ -197,6 +198,28 @@ class ConfigPanel(panel.Panel):
     # the 'important' flag are shown
     self.showAll = False
     
+    # initializes config contents if we're connected
+    conn = torTools.getConn()
+    conn.addStatusListener(self.resetListener)
+    
+    if conn.isAlive():
+      self.resetListener(conn, torTools.State.INIT)
+  
+  def resetListener(self, conn, eventType):
+    # fetches configuration options if a new instance, otherewise keeps our
+    # current contents
+    
+    if eventType == torTools.State.INIT:
+      self._loadConfigOptions()
+  
+  def _loadConfigOptions(self):
+    """
+    Fetches the configuration options available from tor or arm.
+    """
+    
+    self.confContents = []
+    self.confImportantContents = []
+    
     if self.configType == State.TOR:
       conn, configOptionLines = torTools.getConn(), []
       customOptions = torConfig.getCustomOptions()



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits