Commit 4e185356 authored by Hugo Beauzée-Luyssen's avatar 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.
parent 71dd06f6
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment