Commit 88dc675a authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen Committed by Jean-Baptiste Kempf

dash: Don't crash when a segment can't be accessed.

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent cbef7d0c
......@@ -66,11 +66,11 @@ void HTTPConnection::parseURL ()
this->request = "GET " + this->path + " HTTP/1.1\r\n" +
"Host: " + this->hostname + "\r\nConnection: close\r\n\r\n";
}
bool HTTPConnection::init ()
bool HTTPConnection::init()
{
this->urlStream = stream_UrlNew(this->stream, this->url.c_str());
this->urlStream = stream_UrlNew( this->stream, this->url.c_str() );
if(!this->urlStream)
if( this->urlStream == NULL )
return false;
return true;
......
......@@ -127,7 +127,8 @@ int HTTPConnectionManager::read (Chunk *chun
this->bytesReadChunk = 0;
this->timeSecChunk = 0;
this->initConnection(chunk);
if ( this->initConnection(chunk) == NULL )
return -1;
return this->read(chunk, p_buffer, len);
}
}
......@@ -136,13 +137,16 @@ int HTTPConnectionManager::peek (Chunk *chun
if(this->chunkMap.find(chunk) != this->chunkMap.end())
return this->chunkMap[chunk]->peek(pp_peek, i_peek);
this->initConnection(chunk);
if ( this->initConnection(chunk) == NULL )
return -1;
return this->peek(chunk, pp_peek, i_peek);
}
HTTPConnection* HTTPConnectionManager::initConnection (Chunk *chunk)
IHTTPConnection* HTTPConnectionManager::initConnection(Chunk *chunk)
{
HTTPConnection *con = new HTTPConnection(chunk->getUrl(), this->stream);
con->init();
if ( con->init() == false )
return NULL;
this->connections.push_back(con);
this->chunkMap[chunk] = con;
this->chunkCount++;
......
......@@ -69,8 +69,8 @@ namespace dash
stream_t *stream;
int chunkCount;
bool closeConnection (Chunk *chunk);
HTTPConnection* initConnection (Chunk *chunk);
bool closeConnection( Chunk *chunk );
IHTTPConnection* initConnection( Chunk *chunk );
};
}
......
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