[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [libktorrent] 971869d: Simplify PeerConnector cleanup code
From:       Joris <joris.guisson () gmail ! com>
Date:       2010-11-30 20:09:05
Message-ID: 20101130200905.E8DD5A60A6 () git ! kde ! org
[Download RAW message or body]

commit 971869dcfaf2a87b3b3faa67cbb634d7efed2e9b
branch master
Author: Joris <joris.guisson@gmail.com>
Date:   Tue Nov 30 21:07:15 2010 +0100

    Simplify PeerConnector cleanup code

diff --git a/ChangeLog b/ChangeLog
index a166938..f1671cb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -28,6 +28,7 @@ Changes in 1.0.5:
 - Backport fix for bug which causes some chunks not to get unmapped properly
 - Make sure UTPServer is running when setting up a connection with a UTPSocket (254334)
 - Increase maximum packet size to fix a bug causing peers to be dropped when they shouldn't (255264)
+- Simplify PeerConnector cleanup code
 
 Changes in 1.0.4:
 - Fix race condition causing timers not to be removed in the  µTP code, resulting in a crash (251117)
diff --git a/src/peer/peerconnector.cpp b/src/peer/peerconnector.cpp
index 8f43f3d..6cc145c 100644
--- a/src/peer/peerconnector.cpp
+++ b/src/peer/peerconnector.cpp
@@ -50,7 +50,6 @@ namespace bt
 		}
 		
 		void start(Method method);
-		void stop();
 		void authenticationFinished(Authenticate* auth, bool ok);
 		
 	public:
@@ -112,27 +111,6 @@ namespace bt
 				d->start(TCP_WITHOUT_ENCRYPTION);
 		}
 	}
-	
-	void PeerConnector::Private::stop()
-	{
-		if (auth)
-		{
-			// Add all methods to the tried_methods set, so the authentication will stop
-			tried_methods.insert(UTP_WITH_ENCRYPTION);
-			tried_methods.insert(TCP_WITH_ENCRYPTION);
-			tried_methods.insert(UTP_WITHOUT_ENCRYPTION);
-			tried_methods.insert(TCP_WITHOUT_ENCRYPTION);
-			auth->stop();
-		}
-	}
-	
-	void PeerConnector::stop()
-	{
-		d->stop();
-		release();
-	}
-
-
 
 	void PeerConnector::authenticationFinished(Authenticate* auth, bool ok)
 	{
diff --git a/src/peer/peerconnector.h b/src/peer/peerconnector.h
index 74239dd..6a6987c 100644
--- a/src/peer/peerconnector.h
+++ b/src/peer/peerconnector.h
@@ -56,9 +56,6 @@ namespace bt
 		/// Start connecting
 		void start();
 		
-		/// Stop connecting
-		void stop();
-		
 		/**
 		 * Set the maximum number of active PeerConnectors allowed
 		 */
diff --git a/src/peer/peermanager.cpp b/src/peer/peermanager.cpp
index e7eedce..996cfa9 100644
--- a/src/peer/peermanager.cpp
+++ b/src/peer/peermanager.cpp
@@ -429,6 +429,7 @@ namespace bt
 		d->available_chunks.clear();
 		d->started = false;
 		ServerInterface::removePeerManager(this);
+		qDeleteAll(d->connectors);
 		d->connectors.clear();
 		
 		if (d->superseeder)
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic