| 
      
      
      From: <arn...@us...> - 2008-03-01 22:00:50
      
     | 
| Revision: 1020
          http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=1020&view=rev
Author:   arnetheduck
Date:     2008-03-01 14:00:01 -0800 (Sat, 01 Mar 2008)
Log Message:
-----------
auto-coral all urls, mem leak fix
Modified Paths:
--------------
    dcplusplus/trunk/changelog.txt
    dcplusplus/trunk/dcpp/BufferedSocket.cpp
    dcplusplus/trunk/dcpp/CryptoManager.cpp
    dcplusplus/trunk/dcpp/FavoriteManager.h
    dcplusplus/trunk/dcpp/HttpConnection.cpp
    dcplusplus/trunk/dcpp/SettingsManager.cpp
    dcplusplus/trunk/dcpp/SettingsManager.h
    dcplusplus/trunk/win32/AboutDlg.cpp
    dcplusplus/trunk/win32/AdvancedPage.cpp
    dcplusplus/trunk/win32/MainWindow.cpp
Modified: dcplusplus/trunk/changelog.txt
===================================================================
--- dcplusplus/trunk/changelog.txt	2008-02-29 22:58:00 UTC (rev 1019)
+++ dcplusplus/trunk/changelog.txt	2008-03-01 22:00:01 UTC (rev 1020)
@@ -39,7 +39,9 @@
 * Fixed clicking on active tab (poy)
 * [L#195209] Fixed tabbing in hub windows (poy)
 * [L#195209] Fixed Ctrl+F that opens favorite hubs (poy)
+* [L#194696] Fixed small memory leak
 
+
 -- 0.704 2007-12-14 --
 * Hub lists added to utilize Coral's distributed network (ullner)
 * Use system header arrows on common controls 6+ (thanks poy)
Modified: dcplusplus/trunk/dcpp/BufferedSocket.cpp
===================================================================
--- dcplusplus/trunk/dcpp/BufferedSocket.cpp	2008-02-29 22:58:00 UTC (rev 1019)
+++ dcplusplus/trunk/dcpp/BufferedSocket.cpp	2008-03-01 22:00:01 UTC (rev 1020)
@@ -411,30 +411,34 @@
 			continue;
 		}
 
-		switch(p.first) {
-			case SEND_DATA:
-				threadSendData(); break;
-			case SEND_FILE:
-				threadSendFile(((SendFileInfo*)p.second)->stream); break;
-			case CONNECT:
-				{
-					ConnectInfo* ci = (ConnectInfo*)p.second;
-					threadConnect(ci->addr, ci->port, ci->proxy);
+		try {
+			switch(p.first) {
+				case SEND_DATA:
+					threadSendData(); break;
+				case SEND_FILE:
+					threadSendFile(((SendFileInfo*)p.second)->stream); break;
+				case CONNECT:
+					{
+						ConnectInfo* ci = (ConnectInfo*)p.second;
+						threadConnect(ci->addr, ci->port, ci->proxy);
+						break;
+					}
+				case DISCONNECT:
+					if(isConnected())
+						fail(_("Disconnected"));
 					break;
-				}
-			case DISCONNECT:
-				if(isConnected())
-					fail(_("Disconnected"));
-				break;
-			case SHUTDOWN:
-				return false;
-			case ACCEPTED:
-				break;
-			case UPDATED:
-				fire(BufferedSocketListener::Updated());
-				break;
+				case SHUTDOWN:
+					return false;
+				case ACCEPTED:
+					break;
+				case UPDATED:
+					fire(BufferedSocketListener::Updated());
+					break;
+			}
+		} catch(...) {
+			delete p.second;
+			throw;
 		}
-
 		delete p.second;
 	}
 	return true;
Modified: dcplusplus/trunk/dcpp/CryptoManager.cpp
===================================================================
--- dcplusplus/trunk/dcpp/CryptoManager.cpp	2008-02-29 22:58:00 UTC (rev 1019)
+++ dcplusplus/trunk/dcpp/CryptoManager.cpp	2008-03-01 22:00:01 UTC (rev 1020)
@@ -149,7 +149,7 @@
 	ssl::X509 x509ss(X509_new());
 	
 	if(!bn || !rsa || !pkey || !nm || !x509ss) {
-		throw new CryptoException("Error creating objects for cert generation");
+		throw CryptoException("Error creating objects for cert generation");
 	}
 	
 	int days = 10;
Modified: dcplusplus/trunk/dcpp/FavoriteManager.h
===================================================================
--- dcplusplus/trunk/dcpp/FavoriteManager.h	2008-02-29 22:58:00 UTC (rev 1019)
+++ dcplusplus/trunk/dcpp/FavoriteManager.h	2008-03-01 22:00:01 UTC (rev 1020)
@@ -122,6 +122,7 @@
 	int lastServer;
 	HubTypes listType;
 	string downloadBuf;
+	bool coral;			///< Currently downloading from a coraled list
 
 	/** Used during loading to prevent saving. */
 	bool dontSave;
Modified: dcplusplus/trunk/dcpp/HttpConnection.cpp
===================================================================
--- dcplusplus/trunk/dcpp/HttpConnection.cpp	2008-02-29 22:58:00 UTC (rev 1019)
+++ dcplusplus/trunk/dcpp/HttpConnection.cpp	2008-03-01 22:00:01 UTC (rev 1020)
@@ -26,6 +26,8 @@
 
 namespace dcpp {
 
+static const std::string CORAL_SUFFIX = ".nyud.net";
+
 /**
  * Downloads a file and returns it as a string
  * @todo Report exceptions
@@ -61,6 +63,12 @@
 		Util::decodeUrl(SETTING(HTTP_PROXY), server, port, file);
 		file = currentUrl;
 	}
+	
+	if(SETTING(CORAL)) {
+		if(server.length() > CORAL_SUFFIX.length() && server.compare(server.length() - CORAL_SUFFIX.length(), CORAL_SUFFIX.length(), CORAL_SUFFIX) != 0) {
+			server += CORAL_SUFFIX;
+		}
+	}
 
 	if(port == 0)
 		port = 80;
Modified: dcplusplus/trunk/dcpp/SettingsManager.cpp
===================================================================
--- dcplusplus/trunk/dcpp/SettingsManager.cpp	2008-02-29 22:58:00 UTC (rev 1019)
+++ dcplusplus/trunk/dcpp/SettingsManager.cpp	2008-03-01 22:00:01 UTC (rev 1020)
@@ -77,7 +77,7 @@
 	"UseTLS", "AutoSearchLimit", "AltSortOrder", "AutoKickNoFavs", "PromptPassword", "SpyFrameIgnoreTthSearches",
 	"DontDlAlreadyQueued", "MaxCommandLength", "AllowUntrustedHubs", "AllowUntrustedClients",
 	"TLSPort", "FastHash", "SortFavUsersFirst", "ShowShellMenu", "MinSegmentSize", "FollowLinks",
-	"SendBloom", "OwnerDrawnMenus",
+	"SendBloom", "OwnerDrawnMenus", "Coral",
 	"SENTRY",
 	// Int64
 	"TotalUpload", "TotalDownload",
@@ -136,7 +136,7 @@
 	setDefault(IGNORE_BOT_PMS, false);
 	setDefault(LIST_DUPES, true);
 	setDefault(BUFFER_SIZE, 64);
-	setDefault(HUBLIST_SERVERS, "http://hublist.hubtracker.com.nyud.net/hublist.xml.bz2;http://dchublist.com.nyud.net/hublist.xml.bz2;http://adchublist.com.nyud.net/hublist.xml.bz2;http://www.hublist.org.nyud.net/PublicHubList.xml.bz2;http://dclist.eu.nyud.net/hublist.xml.bz2;http://download.hublist.cz.nyud.net/hublist.xml.bz2;http://hublist.awenet.info.nyud.net/PublicHubList.xml.bz2");
+	setDefault(HUBLIST_SERVERS, "http://hublist.hubtracker.com/hublist.xml.bz2;http://dchublist.com/hublist.xml.bz2;http://adchublist.com/hublist.xml.bz2;http://www.hublist.org/PublicHubList.xml.bz2;http://dclist.eu/hublist.xml.bz2;http://download.hublist.cz/hublist.xml.bz2;http://hublist.awenet.info/PublicHubList.xml.bz2");
 	setDefault(DOWNLOAD_SLOTS, 3);
 	setDefault(MAX_DOWNLOAD_SPEED, 0);
 	setDefault(LOG_DIRECTORY, Util::getConfigPath() + "Logs" PATH_SEPARATOR_STR);
@@ -274,7 +274,8 @@
 	setDefault(FOLLOW_LINKS, false);
 	setDefault(SEND_BLOOM, true);
 	setDefault(OWNER_DRAWN_MENUS, true);
-
+	setDefault(CORAL, true);
+	
 #ifdef _WIN32
 	setDefault(MAIN_WINDOW_STATE, SW_SHOWNORMAL);
 	setDefault(MAIN_WINDOW_SIZE_X, CW_USEDEFAULT);
Modified: dcplusplus/trunk/dcpp/SettingsManager.h
===================================================================
--- dcplusplus/trunk/dcpp/SettingsManager.h	2008-02-29 22:58:00 UTC (rev 1019)
+++ dcplusplus/trunk/dcpp/SettingsManager.h	2008-03-01 22:00:01 UTC (rev 1020)
@@ -90,7 +90,7 @@
 		USE_TLS, AUTO_SEARCH_LIMIT, ALT_SORT_ORDER, AUTO_KICK_NO_FAVS, PROMPT_PASSWORD, SPY_FRAME_IGNORE_TTH_SEARCHES,
 		DONT_DL_ALREADY_QUEUED, MAX_COMMAND_LENGTH, ALLOW_UNTRUSTED_HUBS, ALLOW_UNTRUSTED_CLIENTS,
 		TLS_PORT, FAST_HASH, SORT_FAVUSERS_FIRST, SHOW_SHELL_MENU, MIN_SEGMENT_SIZE, FOLLOW_LINKS,
-		SEND_BLOOM, OWNER_DRAWN_MENUS,
+		SEND_BLOOM, OWNER_DRAWN_MENUS, CORAL,
 		INT_LAST };
 
 	enum Int64Setting { INT64_FIRST = INT_LAST + 1,
Modified: dcplusplus/trunk/win32/AboutDlg.cpp
===================================================================
--- dcplusplus/trunk/win32/AboutDlg.cpp	2008-02-29 22:58:00 UTC (rev 1019)
+++ dcplusplus/trunk/win32/AboutDlg.cpp	2008-03-01 22:00:01 UTC (rev 1020)
@@ -67,7 +67,7 @@
 	centerWindow();
 
 	c.addListener(this);
-	c.downloadFile("http://dcplusplus.sourceforge.net.nyud.net/version.xml");
+	c.downloadFile("http://dcplusplus.sourceforge.net/version.xml");
 
 	return false;
 }
Modified: dcplusplus/trunk/win32/AdvancedPage.cpp
===================================================================
--- dcplusplus/trunk/win32/AdvancedPage.cpp	2008-02-29 22:58:00 UTC (rev 1019)
+++ dcplusplus/trunk/win32/AdvancedPage.cpp	2008-03-01 22:00:01 UTC (rev 1020)
@@ -47,6 +47,7 @@
 	{ SettingsManager::AUTO_KICK_NO_FAVS, N_("Don't automatically disconnect favorite users who leave the hub") },
 	{ SettingsManager::SHOW_SHELL_MENU, N_("Show shell menu where possible") },
 	{ SettingsManager::OWNER_DRAWN_MENUS, N_("Use extended menus with icons and titles") },
+	{ SettingsManager::CORAL, N_("Use Coral network when downloading hub lists (improves reliability)") },
 	{ 0, 0 }
 };
 
Modified: dcplusplus/trunk/win32/MainWindow.cpp
===================================================================
--- dcplusplus/trunk/win32/MainWindow.cpp	2008-02-29 22:58:00 UTC (rev 1019)
+++ dcplusplus/trunk/win32/MainWindow.cpp	2008-03-01 22:00:01 UTC (rev 1020)
@@ -106,7 +106,7 @@
 
 	c = new HttpConnection;
 	c->addListener(this);
-	c->downloadFile("http://dcplusplus.sourceforge.net.nyud.net/version.xml");
+	c->downloadFile("http://dcplusplus.sourceforge.net/version.xml");
 
 	File::ensureDirectory(SETTING(LOG_DIRECTORY));
 	startSocket();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |