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

[vidalia-svn] r2541: Disable port forwarding when Tor shuts down (in vidalia/branches/upnp/src/vidalia: . config)



Author: sjmurdoch
Date: 2008-04-28 06:13:41 -0400 (Mon, 28 Apr 2008)
New Revision: 2541

Modified:
   vidalia/branches/upnp/src/vidalia/config/serversettings.h
   vidalia/branches/upnp/src/vidalia/mainwindow.cpp
Log:
Disable port forwarding when Tor shuts down

Modified: vidalia/branches/upnp/src/vidalia/config/serversettings.h
===================================================================
--- vidalia/branches/upnp/src/vidalia/config/serversettings.h	2008-04-26 17:50:47 UTC (rev 2540)
+++ vidalia/branches/upnp/src/vidalia/config/serversettings.h	2008-04-28 10:13:41 UTC (rev 2541)
@@ -82,6 +82,9 @@
   /** Gets the maximum burst rate (in B/s) of this server. */
   quint32 getBandwidthBurstRate();
 
+  /** If enable is true, configure UPnP device to forward ORPort, otherwise remove mapping */
+  void configurePortForwarding(bool enable);
+
 protected:
   /** Virtual method called when we retrieve a server-related setting from Tor.
    * Currently this just translates BandwidthFoo to RelayBandwidthFoo when
@@ -91,9 +94,6 @@
 private:
   /** Returns Tor-recognizable configuration keys and current values. */
   QHash<QString,QString> confValues();
-
-  /** Configure UPnP device to forward DirPort and ORPort */
-  void configurePortForwarding(bool enable);
 };
 
 #endif

Modified: vidalia/branches/upnp/src/vidalia/mainwindow.cpp
===================================================================
--- vidalia/branches/upnp/src/vidalia/mainwindow.cpp	2008-04-26 17:50:47 UTC (rev 2540)
+++ vidalia/branches/upnp/src/vidalia/mainwindow.cpp	2008-04-28 10:13:41 UTC (rev 2541)
@@ -225,6 +225,10 @@
   if (_torControl->isVidaliaRunningTor()) {
     /* Kill our Tor process now */ 
     _torControl->stop();
+
+    /* Disable port forwarding */
+    ServerSettings settings(_torControl);
+    settings.configurePortForwarding(false);
   }
 
   if (_proxyProcess->state() != QProcess::NotRunning) {