[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r2546: Move winsock workaround into ServerSettings (in vidalia/branches/upnp/src/vidalia: . config)
Author: sjmurdoch
Date: 2008-04-29 07:15:07 -0400 (Tue, 29 Apr 2008)
New Revision: 2546
Modified:
vidalia/branches/upnp/src/vidalia/config/serversettings.cpp
vidalia/branches/upnp/src/vidalia/mainwindow.cpp
Log:
Move winsock workaround into ServerSettings
Modified: vidalia/branches/upnp/src/vidalia/config/serversettings.cpp
===================================================================
--- vidalia/branches/upnp/src/vidalia/config/serversettings.cpp 2008-04-29 11:02:45 UTC (rev 2545)
+++ vidalia/branches/upnp/src/vidalia/config/serversettings.cpp 2008-04-29 11:15:07 UTC (rev 2546)
@@ -172,6 +172,15 @@
ServerSettings::configurePortForwarding(bool enable)
{
#ifdef USE_MINIUPNPC
+
+#ifdef WIN32
+ // Workaround from http://trolltech.com/developer/knowledgebase/579
+ WSAData wsadata;
+ if (WSAStartup(MAKEWORD(2,0), &wsadata)!=0) {
+ qFatal("WSAStartup failure while disabling UPnP port forwarding");
+ }
+#endif
+
UPNPControl *pUNPControl = UPNPControl::Instance();
// Remove all port forwards
@@ -190,7 +199,12 @@
pUNPControl->forwardDirPort(getDirPort());
else
pUNPControl->disableDirPort();
+
+#ifdef WIN32
+ WSACleanup();
#endif
+
+#endif
}
/** Virtual method called when we retrieve a server-related setting from Tor.
Modified: vidalia/branches/upnp/src/vidalia/mainwindow.cpp
===================================================================
--- vidalia/branches/upnp/src/vidalia/mainwindow.cpp 2008-04-29 11:02:45 UTC (rev 2545)
+++ vidalia/branches/upnp/src/vidalia/mainwindow.cpp 2008-04-29 11:15:07 UTC (rev 2546)
@@ -230,26 +230,10 @@
_torControl->stop();
}
-#ifdef USE_MINIUPNPC
/* Disable port forwarding */
+ ServerSettings settings(_torControl);
+ settings.configurePortForwarding(false);
-#ifdef WIN32
- // Workaround from http://trolltech.com/developer/knowledgebase/579
- WSAData wsadata;
- if (WSAStartup(MAKEWORD(2,0), &wsadata)!=0) {
- qFatal("WSAStartup failure while disabling UPnP port forwarding");
- }
-#endif
-
- UPNPControl *pUNPControl = UPNPControl::Instance();
- pUNPControl->disableForwarding();
-
-#ifdef WIN32
- WSACleanup();
-#endif
-
-#endif
-
if (_proxyProcess->state() != QProcess::NotRunning) {
/* Close the proxy server (Polipo ignores the WM_CLOSE event sent by
* terminate() so we have to kill() it) */