Skip to content
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

mimic: rgw: Adding tcp_nodelay option to Beast #27367

merged 1 commit into from May 6, 2019
Changes from all commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.


Just for now

rgw: Adding tcp_nodelay option to Beast

beast frontend option to set the TCP_NODELAY socket option to match the tcp_nodelay option in civetweb.

Signed-off-by: Or Friedmann <>
(cherry picked from commit fb1bff7)
  • Loading branch information...
ofriedma authored and Prashant D committed Mar 16, 2019
commit eec7fe8f4e046a654bc37c259f07f22dc566aa34
@@ -57,6 +57,19 @@ Options
:Type: String
:Default: None


:Description: If set the socket option will disable Nagle's algorithm on
the connection which means that packets will be sent as soon
as possible instead of waiting for a full buffer or timeout to occur.

``1`` Disable Nagel's algorithm for all sockets.

``0`` Keep the default: Nagel's algorithm enabled.

:Type: Integer (0 or 1)
:Default: 0

@@ -218,6 +218,7 @@ class AsioFrontend {
tcp::acceptor acceptor;
tcp::socket socket;
bool use_ssl = false;
bool use_nodelay = false;

Listener(boost::asio::io_service& service)
: acceptor(service), socket(service) {}
@@ -255,7 +256,7 @@ unsigned short parse_port(const char *input, boost::system::error_code& ec)
return port;

tcp::endpoint parse_endpoint(boost::asio::string_view input,
unsigned short default_port,
boost::system::error_code& ec)
@@ -358,7 +359,14 @@ int AsioFrontend::init()
listeners.back().endpoint = endpoint;

// parse tcp nodelay
auto nodelay = config.find("tcp_nodelay");
if (nodelay != config.end()) {
for (auto& l : listeners) {
l.use_nodelay = (nodelay->second == "1");

// start listeners
for (auto& l : listeners) {, ec);
@@ -476,6 +484,8 @@ void AsioFrontend::accept(Listener& l, boost::system::error_code ec)
throw ec;
auto socket = std::move(l.socket);
tcp::no_delay options(l.use_nodelay);
[this, &l] (boost::system::error_code ec) {
accept(l, ec);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.