Added time measurement to HTTP proxy handler, attempt to make buffers less used when system is under load.
This commit is contained in:
parent
49ef28d68e
commit
0c6cba0237
3 changed files with 7 additions and 3 deletions
|
@ -199,6 +199,7 @@ namespace Connector_HTTP{
|
|||
H.SetHeader("X-Origin", conn->getHost());//add the UID to the headers before copying
|
||||
std::string request = H.BuildRequest();//copy the request for later forwarding to the connector
|
||||
std::string orig_url = H.getUrl();
|
||||
int starttime = time(0);
|
||||
H.Clean();
|
||||
|
||||
//check if a connection exists, and if not create one
|
||||
|
@ -267,6 +268,7 @@ namespace Connector_HTTP{
|
|||
H.SetHeader("X-UID", uid);
|
||||
H.SetHeader("Server", "mistserver/" PACKAGE_VERSION "/" + Util::Config::libver);
|
||||
conn->Send(H.BuildResponse("200", "OK"));
|
||||
conn->flush();
|
||||
}else{
|
||||
//unknown length
|
||||
H.SetHeader("X-UID", uid);
|
||||
|
@ -286,8 +288,8 @@ namespace Connector_HTTP{
|
|||
//forward any and all incoming data directly without parsing
|
||||
conn->Send(myConn->Received());
|
||||
myConn->Received().clear();
|
||||
conn->flush();
|
||||
}
|
||||
conn->spool();
|
||||
usleep(30000);
|
||||
}
|
||||
myConn->close();
|
||||
|
@ -295,7 +297,7 @@ namespace Connector_HTTP{
|
|||
}
|
||||
//print some debug info
|
||||
#if DEBUG >= 4
|
||||
std::cout << "Finished request: " << orig_url << " => " << connector << " (" << uid << ")" << std::endl;
|
||||
std::cout << "Finished request: " << orig_url << " => " << connector << " (" << uid << ") in " << (time(0) - starttime) << "s" << std::endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,8 @@ namespace Connector_HTTP{
|
|||
MP4::ASRT asrt;
|
||||
asrt.SetUpdate(false);
|
||||
asrt.AddQualityEntry("");
|
||||
asrt.AddSegmentRunEntry(1, 199);//1 Segment, 199 Fragments
|
||||
/// \todo Actually use correct number of fragments.
|
||||
asrt.AddSegmentRunEntry(1, 20000);//1 Segment, 20000 Fragments
|
||||
asrt.WriteContent();
|
||||
|
||||
MP4::ABST abst;
|
||||
|
|
|
@ -198,6 +198,7 @@ int main(int argc, char** argv){
|
|||
unsigned int size = htonl(source.getPacket().size());
|
||||
in_out.Send((char*)&size, 4);
|
||||
in_out.Send(source.getPacket());
|
||||
in_out.flush();
|
||||
}
|
||||
} else {
|
||||
usleep(std::min(10000LL, lastTime - (now - timeDiff)) * 1000);
|
||||
|
|
Loading…
Add table
Reference in a new issue