Skip to content
This repository was archived by the owner on Apr 2, 2020. It is now read-only.

Commit 984161c

Browse files
author
v-shmelev
committed
Aborted connections didn't notify their clients
1 parent 76f76fe commit 984161c

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

boost/network/protocol/http/server/async_connection.hpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -584,17 +584,16 @@ namespace boost { namespace network { namespace http {
584584

585585
void handle_write_headers(boost::function<void()> callback, boost::system::error_code const & ec, std::size_t bytes_transferred) {
586586
lock_guard lock(headers_mutex);
587-
if (!ec) {
588-
headers_buffer.consume(headers_buffer.size());
589-
headers_already_sent = true;
590-
thread_pool().post(callback);
591-
pending_actions_list::iterator start = pending_actions.begin()
592-
, end = pending_actions.end();
593-
while (start != end) {
594-
thread_pool().post(*start++);
595-
}
596-
} else {
587+
if(ec)
597588
error_encountered = in_place<boost::system::system_error>(ec);
589+
590+
headers_buffer.consume(headers_buffer.size());
591+
headers_already_sent = true;
592+
thread_pool().post(callback);
593+
pending_actions_list::iterator start = pending_actions.begin()
594+
, end = pending_actions.end();
595+
while (start != end) {
596+
thread_pool().post(*start++);
598597
}
599598
pending_actions_list().swap(pending_actions);
600599
}
@@ -669,8 +668,11 @@ namespace boost { namespace network { namespace http {
669668
,shared_buffers buffers)
670669
{
671670
lock_guard lock(headers_mutex);
672-
if (error_encountered)
673-
boost::throw_exception(boost::system::system_error(*error_encountered));
671+
if(error_encountered)
672+
{
673+
callback(error_encountered->code());
674+
return;
675+
}
674676

675677
boost::function<void(boost::system::error_code)> callback_function =
676678
callback;

0 commit comments

Comments
 (0)