Commit 4b6748fe authored by François Cartegnie's avatar François Cartegnie 🤞

demux: adaptive: merge available/canreuse methods

parent 422d6a48
......@@ -50,11 +50,6 @@ bool AbstractConnection::prepare(const ConnectionParams &params_)
return true;
}
bool AbstractConnection::isAvailable() const
{
return available;
}
size_t AbstractConnection::getContentLength() const
{
return contentLength;
......@@ -78,7 +73,8 @@ HTTPConnection::~HTTPConnection()
bool HTTPConnection::canReuse(const ConnectionParams &params_) const
{
return ( params.getHostname() == params_.getHostname() &&
return ( available &&
params.getHostname() == params_.getHostname() &&
params.getScheme() == params_.getScheme() &&
params.getPort() == params_.getPort() );
}
......
......@@ -53,7 +53,6 @@ namespace adaptive
virtual int query (const std::string& path, const BytesRange & = BytesRange()) = 0;
virtual ssize_t read (void *p_buffer, size_t len) = 0;
bool isAvailable () const;
virtual size_t getContentLength() const;
virtual void setUsed( bool ) = 0;
......
......@@ -75,7 +75,7 @@ AbstractConnection * HTTPConnectionManager::reuseConnection(ConnectionParams &pa
for(it = connectionPool.begin(); it != connectionPool.end(); ++it)
{
AbstractConnection *conn = *it;
if(conn->isAvailable() && conn->canReuse(params))
if(conn->canReuse(params))
return conn;
}
return NULL;
......
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