summaryrefslogtreecommitdiff
path: root/src/HttpServerCommand.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/HttpServerCommand.cc')
-rw-r--r--src/HttpServerCommand.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/HttpServerCommand.cc b/src/HttpServerCommand.cc
index 28ecca16..92b465ac 100644
--- a/src/HttpServerCommand.cc
+++ b/src/HttpServerCommand.cc
@@ -49,6 +49,7 @@
#include "util.h"
#include "wallclock.h"
#include "fmt.h"
+#include "SocketRecvBuffer.h"
namespace aria2 {
@@ -70,6 +71,7 @@ HttpServerCommand::HttpServerCommand
#else // !HAVE_LIBZ
httpServer_->disableGZip();
#endif // !HAVE_LIBZ
+ checkSocketRecvBuffer();
}
HttpServerCommand::HttpServerCommand
@@ -83,6 +85,7 @@ HttpServerCommand::HttpServerCommand
httpServer_(httpServer)
{
e_->addSocketForReadCheck(socket_, this);
+ checkSocketRecvBuffer();
}
HttpServerCommand::~HttpServerCommand()
@@ -90,13 +93,22 @@ HttpServerCommand::~HttpServerCommand()
e_->deleteSocketForReadCheck(socket_, this);
}
+void HttpServerCommand::checkSocketRecvBuffer()
+{
+ if(!httpServer_->getSocketRecvBuffer()->bufferEmpty()) {
+ setStatus(Command::STATUS_ONESHOT_REALTIME);
+ e_->setNoWait(true);
+ }
+}
+
bool HttpServerCommand::execute()
{
if(e_->getRequestGroupMan()->downloadFinished() || e_->isHaltRequested()) {
return true;
}
try {
- if(socket_->isReadable(0)) {
+ if(socket_->isReadable(0) ||
+ !httpServer_->getSocketRecvBuffer()->bufferEmpty()) {
timeoutTimer_ = global::wallclock;
SharedHandle<HttpHeader> header;