[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r2544: Work around Windows socket failure (vidalia/branches/upnp/src/vidalia)
Author: sjmurdoch
Date: 2008-04-28 13:19:27 -0400 (Mon, 28 Apr 2008)
New Revision: 2544
Modified:
vidalia/branches/upnp/src/vidalia/mainwindow.cpp
Log:
Work around Windows socket failure
Modified: vidalia/branches/upnp/src/vidalia/mainwindow.cpp
===================================================================
--- vidalia/branches/upnp/src/vidalia/mainwindow.cpp 2008-04-28 12:48:55 UTC (rev 2543)
+++ vidalia/branches/upnp/src/vidalia/mainwindow.cpp 2008-04-28 17:19:27 UTC (rev 2544)
@@ -32,6 +32,9 @@
#include "mainwindow.h"
+#ifdef USE_MINIUPNPC
+#include "upnpcontrol.h"
+#endif
#define IMG_BWGRAPH ":/images/16x16/utilities-system-monitor.png"
#define IMG_CONTROL_PANEL ":/images/16x16/preferences-desktop.png"
@@ -227,11 +230,26 @@
_torControl->stop();
}
+#ifdef USE_MINIUPNPC
/* Disable port forwarding */
- // TODO: This causes "Socket error: socket, 10093". Why?
- 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) */