-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Coroutinize http client code #2429
base: master
Are you sure you want to change the base?
Commits on Sep 12, 2024
-
http/client: Coroutinize connection::write_body
And brush up the if-else nesting a little bit to avoid co_return-s Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 797dc34 - Browse repository at this point
Copy the full SHA 797dc34View commit details -
http/client: Coroutinize connection::maybe_wait_for_continue
For simplicity, wrap the entrance `if` around. Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 32365d4 - Browse repository at this point
Copy the full SHA 32365d4View commit details -
http/client: Coroutinize connection::send_request_head
Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for e8df44b - Browse repository at this point
Copy the full SHA e8df44bView commit details -
http/client: Coroutinize connection::recv_reply
And leave indentation broken until next patch Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for dd51c2c - Browse repository at this point
Copy the full SHA dd51c2cView commit details -
http/client: Restore indentation of connection::recv_reply
Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for ad9833d - Browse repository at this point
Copy the full SHA ad9833dView commit details -
http/client: Coroutinize connection::do_make_request
Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 9b46ea5 - Browse repository at this point
Copy the full SHA 9b46ea5View commit details -
http/client: Restore indentation of connection::do_make_request
Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 86d6a8b - Browse repository at this point
Copy the full SHA 86d6a8bView commit details -
http/client: Squash maybe_wait_for_continue into do_make_request
The former helper was introduced to reduce the netsing of .then-chains. Now when it's a coroutinie, it's better be squashed with its only caller. Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 14e3efc - Browse repository at this point
Copy the full SHA 14e3efcView commit details -
http/client Squash send_request_head into do_make_request
Same as previous patch -- the former method was a way to reduce indentation level for the latter. Now they look good enough when squashed. Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for c5a63be - Browse repository at this point
Copy the full SHA c5a63beView commit details -
http/client: Coroutinize connection::make_request
Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 9b473bf - Browse repository at this point
Copy the full SHA 9b473bfView commit details -
http/client: Coroutinize connection::close
There's a trickery there. After _closed future is resolved "this" may become freed already. So to make the last log message printed, the this->local_address was saved into .then capture. When coroutinized, that field is kept on stack. Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for ffacf24 - Browse repository at this point
Copy the full SHA ffacf24View commit details -
http/client: Restore indentation of connection::close
Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for cb1b4b6 - Browse repository at this point
Copy the full SHA cb1b4b6View commit details -
http/client: Coroutinize client::make_connection
Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for bd36cf3 - Browse repository at this point
Copy the full SHA bd36cf3View commit details -
http/client: Restore indentation of client::make_connection
Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for bdfdf16 - Browse repository at this point
Copy the full SHA bdfdf16View commit details -
http/client: Coroutinize client::put_connection
There's a trickery here. After con->close() is resolved, the con may be the last pointer holding the connection alive. Before this patch, it was saved on .finally capture, after it -- it's preserved as on-stack variable. Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 2d1550e - Browse repository at this point
Copy the full SHA 2d1550eView commit details -
http/client: Coroutinize client::shrink_connections
In its .then-chain form the method calls itself to emulate "goto again" without goto. To do the same with coroutines, wrap it into a loop. Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 215e024 - Browse repository at this point
Copy the full SHA 215e024View commit details -
http/client: Restore indentation of client::shrink_connections
Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 88de135 - Browse repository at this point
Copy the full SHA 88de135View commit details -
http/client: Coroutinize client::set_maximum_connections
Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for b10c8b6 - Browse repository at this point
Copy the full SHA b10c8b6View commit details -
http/client: Coroutinize client::with_connection
Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 685f6f2 - Browse repository at this point
Copy the full SHA 685f6f2View commit details -
http/client: Coroutinize client::with_new_connection
Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 200ea10 - Browse repository at this point
Copy the full SHA 200ea10View commit details -
http/client: Coroutinize client::close
This method closes all its connection by calling itself until the pool is empty. With coroutines it is done with the plain loop. Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 4250bca - Browse repository at this point
Copy the full SHA 4250bcaView commit details -
http/client: Restore indentation of client::close
Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 688ac04 - Browse repository at this point
Copy the full SHA 688ac04View commit details -
http/client: Coroutinize client::do_make_request
Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 3e22a25 - Browse repository at this point
Copy the full SHA 3e22a25View commit details -
http/client: Sanitize client::do_make_request unexpected body logging
When reply contains unexpected status, client may print its body in logs. Before being coroutinized it was two disctinct chains, with coroutines it makes sense to rewrap them a little bit. Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 02df7b8 - Browse repository at this point
Copy the full SHA 02df7b8View commit details -
http/client: Coroutinize client::get_connection
It used to call itself to "goto again". With coroutines it won't work as nice, neither it looks good enough with the outer loop :( So use goto explicitly. Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 4dfb090 - Browse repository at this point
Copy the full SHA 4dfb090View commit details -
http/client: Restore indentation of client::get_connection
Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 539fa2a - Browse repository at this point
Copy the full SHA 539fa2aView commit details -
http/client: Coroutinize client::do_make_request (con-less overload)
It makes some non-trivial decisions on whether or to retry the request in the catch block, so the conversion is a bit hairy. Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 3231966 - Browse repository at this point
Copy the full SHA 3231966View commit details -
http/client: Restore indentation of client::do_make_request overload
Signed-off-by: Pavel Emelyanov <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 67134fd - Browse repository at this point
Copy the full SHA 67134fdView commit details