Fixed HTTP proxy not correctly handling connectors that disconnect in between handling requests.

This commit is contained in:
Thulinma 2013-08-28 15:49:45 +02:00
parent a343b67f09
commit 59b21d94ec

View file

@ -391,7 +391,7 @@ namespace Connector_HTTP {
//check if a connection exists, and if not create one //check if a connection exists, and if not create one
connMutex.lock(); connMutex.lock();
if ( !connectorConnections.count(uid) || !connectorConnections[uid]->conn->connected()){ if ( !connectorConnections.count(uid) || (!connectorConnections[uid]->conn->spool() && !connectorConnections[uid]->conn->connected())){
if (connectorConnections.count(uid)){ if (connectorConnections.count(uid)){
delete connectorConnections[uid]; delete connectorConnections[uid];
connectorConnections.erase(uid); connectorConnections.erase(uid);
@ -462,7 +462,7 @@ namespace Connector_HTTP {
} }
break; //continue down below this while loop break; //continue down below this while loop
} }
}else{ }
//keep trying unless the timeout triggers //keep trying unless the timeout triggers
if (timeout++ > 4000){ if (timeout++ > 4000){
std::cout << "[20s timeout triggered]" << std::endl; std::cout << "[20s timeout triggered]" << std::endl;
@ -475,7 +475,6 @@ namespace Connector_HTTP {
Util::sleep(5); Util::sleep(5);
} }
} }
}
//unset to only read headers //unset to only read headers
H.headerOnly = false; H.headerOnly = false;
if ( !myCConn->conn->connected() || !conn->connected()){ if ( !myCConn->conn->connected() || !conn->connected()){