diff options
author | AnotherTest <ali.mpfard@gmail.com> | 2020-12-31 01:42:44 +0330 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-12-31 16:57:09 +0100 |
commit | 2568a93b5dd29d2b06d613a4ece502ee696f189a (patch) | |
tree | e3d7853f2327a541ef3deec7ffacf1c8cb36353b /Libraries/LibGemini/Job.cpp | |
parent | 83fed3fd5de71c0eed7390a3cee3de6627bec3bd (diff) | |
download | serenity-2568a93b5dd29d2b06d613a4ece502ee696f189a.zip |
ProtocolServer: Avoid blocking all downloads when client stops reading
Fixes #4668.
Diffstat (limited to 'Libraries/LibGemini/Job.cpp')
-rw-r--r-- | Libraries/LibGemini/Job.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Libraries/LibGemini/Job.cpp b/Libraries/LibGemini/Job.cpp index d167c7eaef..8c6265de26 100644 --- a/Libraries/LibGemini/Job.cpp +++ b/Libraries/LibGemini/Job.cpp @@ -165,10 +165,12 @@ void Job::finish_up() m_state = State::Finished; flush_received_buffers(); if (m_received_size != 0) { - // FIXME: What do we do? ignore it? - // "Transmission failed" is not strictly correct, but let's roll with it for now. + // We have to wait for the client to consume all the downloaded data + // before we can actually call `did_finish`. in a normal flow, this should + // never be hit since the client is reading as we are writing, unless there + // are too many concurrent downloads going on. deferred_invoke([this](auto&) { - did_fail(Error::TransmissionFailed); + finish_up(); }); return; } |