Add tcp_nodelay flag that is by default on
This commit is contained in:
parent
d1291be0b7
commit
edf74d2494
2
helio
2
helio
|
@ -1 +1 @@
|
|||
Subproject commit ec055f6bb2476aaebda441cbf1fc3c738bf5a4c6
|
||||
Subproject commit 1b01326ec8689e559dcf4c5be6f328055479e808
|
|
@ -36,6 +36,9 @@ void RunEngine(ProactorPool* pool, AcceptServer* acceptor, HttpListener<>* http)
|
|||
} // namespace dfly
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
gflags::SetUsageMessage("dragonfly [FLAGS]");
|
||||
gflags::SetVersionString("v0.2");
|
||||
|
||||
MainInitGuard guard(&argc, &argv);
|
||||
|
||||
CHECK_GT(FLAGS_port, 0u);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2021, Roman Gershman. All rights reserved.
|
||||
// Copyright 2022, Roman Gershman. All rights reserved.
|
||||
// See LICENSE for licensing terms.
|
||||
//
|
||||
|
||||
|
@ -22,6 +22,8 @@
|
|||
#include "util/tls/tls_socket.h"
|
||||
#include "util/uring/uring_socket.h"
|
||||
|
||||
DEFINE_bool(tcp_nodelay, true, "Configures dragonfly connections with socket option TCP_NODELAY");
|
||||
|
||||
using namespace util;
|
||||
using namespace std;
|
||||
using nonstd::make_unexpected;
|
||||
|
@ -137,9 +139,12 @@ void Connection::UnregisterShutdownHook(ShutdownHandle id) {
|
|||
void Connection::HandleRequests() {
|
||||
this_fiber::properties<FiberProps>().set_name("DflyConnection");
|
||||
|
||||
int val = 1;
|
||||
LinuxSocketBase* lsb = static_cast<LinuxSocketBase*>(socket_.get());
|
||||
|
||||
if (FLAGS_tcp_nodelay) {
|
||||
int val = 1;
|
||||
CHECK_EQ(0, setsockopt(lsb->native_handle(), SOL_TCP, TCP_NODELAY, &val, sizeof(val)));
|
||||
}
|
||||
|
||||
auto remote_ep = lsb->RemoteEndpoint();
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ VOLUME /data
|
|||
WORKDIR /data
|
||||
COPY tools/docker/entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
COPY --from=builder /build/build-opt/dragonfly /usr/local/bin/
|
||||
RUN dragonfly -version
|
||||
|
||||
ENTRYPOINT ["entrypoint.sh"]
|
||||
|
||||
|
|
Loading…
Reference in New Issue