[vlc-commits] dash: HTTPConnectionManager: Removing duplicate attribute.
Hugo Beauzée-Luyssen
git at videolan.org
Thu Feb 2 14:40:23 CET 2012
vlc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Thu Jan 12 16:34:45 2012 +0100| [4e185356f7a6d3a6dc15ef545d6cf0aa921cdd94] | committer: Hugo Beauzée-Luyssen
dash: HTTPConnectionManager: Removing duplicate attribute.
Connection list was stored twice: once as a stand-alone list, once as a
map of Chunk/Connection.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4e185356f7a6d3a6dc15ef545d6cf0aa921cdd94
---
.../dash/http/HTTPConnectionManager.cpp | 25 +++++--------------
.../dash/http/HTTPConnectionManager.h | 1 -
2 files changed, 7 insertions(+), 19 deletions(-)
diff --git a/modules/stream_filter/dash/http/HTTPConnectionManager.cpp b/modules/stream_filter/dash/http/HTTPConnectionManager.cpp
index cc5637b..b79947f 100644
--- a/modules/stream_filter/dash/http/HTTPConnectionManager.cpp
+++ b/modules/stream_filter/dash/http/HTTPConnectionManager.cpp
@@ -26,6 +26,7 @@
#endif
#include "HTTPConnectionManager.h"
+#include "mpd/Segment.h"
using namespace dash::http;
using namespace dash::logic;
@@ -48,14 +49,13 @@ HTTPConnectionManager::~HTTPConnectionManager ()
bool HTTPConnectionManager::closeConnection( IHTTPConnection *con )
{
- for(std::vector<HTTPConnection *>::iterator it = this->connections.begin();
- it != this->connections.end(); ++it)
+ for(std::map<Chunk*, HTTPConnection *>::iterator it = this->chunkMap.begin();
+ it != this->chunkMap.end(); ++it)
{
- if(*it == con)
+ if( it->second == con )
{
- (*it)->closeSocket();
- delete(*it);
- this->connections.erase(it);
+ delete con;
+ this->chunkMap.erase( it );
return true;
}
}
@@ -73,20 +73,10 @@ bool HTTPConnectionManager::closeConnection( Chunk *chunk )
void HTTPConnectionManager::closeAllConnections ()
{
- for(std::vector<HTTPConnection *>::iterator it = this->connections.begin(); it != this->connections.end(); ++it)
- {
- (*it)->closeSocket();
- delete(*it);
- }
- this->connections.clear();
- this->urlMap.clear();
-
std::map<Chunk *, HTTPConnection *>::iterator it;
for(it = this->chunkMap.begin(); it != this->chunkMap.end(); ++it)
- {
- delete(it->first);
- }
+ delete(it->second);
this->chunkMap.clear();
}
@@ -150,7 +140,6 @@ IHTTPConnection* HTTPConnectionManager::initConnection(Chunk *chunk)
HTTPConnection *con = new HTTPConnection(chunk->getUrl(), this->stream);
if ( con->init() == false )
return NULL;
- this->connections.push_back(con);
this->chunkMap[chunk] = con;
this->chunkCount++;
return con;
diff --git a/modules/stream_filter/dash/http/HTTPConnectionManager.h b/modules/stream_filter/dash/http/HTTPConnectionManager.h
index c82c937..3a5366a 100644
--- a/modules/stream_filter/dash/http/HTTPConnectionManager.h
+++ b/modules/stream_filter/dash/http/HTTPConnectionManager.h
@@ -56,7 +56,6 @@ namespace dash
void notify ();
private:
- std::vector<HTTPConnection *> connections;
std::map<Chunk *, HTTPConnection *> chunkMap;
std::map<std::string, HTTPConnection *> urlMap;
std::vector<dash::logic::IDownloadRateObserver *> rateObservers;
More information about the vlc-commits
mailing list