@@ -584,17 +584,16 @@ namespace boost { namespace network { namespace http {
584
584
585
585
void handle_write_headers (boost::function<void ()> callback, boost::system::error_code const & ec, std::size_t bytes_transferred) {
586
586
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)
597
588
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++);
598
597
}
599
598
pending_actions_list ().swap (pending_actions);
600
599
}
@@ -669,8 +668,11 @@ namespace boost { namespace network { namespace http {
669
668
,shared_buffers buffers)
670
669
{
671
670
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
+ }
674
676
675
677
boost::function<void (boost::system::error_code)> callback_function =
676
678
callback;
0 commit comments