Software /
code /
prosody
Comparison
net/server_epoll.lua @ 11689:f9f6e82fb572
net.server_epoll: Add setting for disabling the Nagle algorithm
Nagle increases latency and is the bane of all networking!
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 14 Jul 2021 22:27:12 +0200 |
parent | 11688:3fc564f7441b |
child | 11694:d6be4dda1f60 |
comparison
equal
deleted
inserted
replaced
11688:3fc564f7441b | 11689:f9f6e82fb572 |
---|---|
81 -- Attempt writes instantly | 81 -- Attempt writes instantly |
82 opportunistic_writes = false; | 82 opportunistic_writes = false; |
83 | 83 |
84 -- TCP Keepalives | 84 -- TCP Keepalives |
85 tcp_keepalive = false; -- boolean | number | 85 tcp_keepalive = false; -- boolean | number |
86 | |
87 -- Whether to let the Nagle algorithm stay enabled | |
88 nagle = true; | |
86 }}; | 89 }}; |
87 local cfg = default_config.__index; | 90 local cfg = default_config.__index; |
88 | 91 |
89 local fds = createtable(10, 0); -- FD -> conn | 92 local fds = createtable(10, 0); -- FD -> conn |
90 | 93 |
729 self:defaultoptions(); | 732 self:defaultoptions(); |
730 return self:add(true, true); | 733 return self:add(true, true); |
731 end | 734 end |
732 | 735 |
733 function interface:defaultoptions() | 736 function interface:defaultoptions() |
737 if cfg.nagle == false then | |
738 self:setoption("tcp-nodelay", true); | |
739 end | |
734 if cfg.tcp_keepalive then | 740 if cfg.tcp_keepalive then |
735 self:setoption("keepalive", true); | 741 self:setoption("keepalive", true); |
736 if type(cfg.tcp_keepalive) == "number" then | 742 if type(cfg.tcp_keepalive) == "number" then |
737 self:setoption("tcp-keepidle", cfg.tcp_keepalive); | 743 self:setoption("tcp-keepidle", cfg.tcp_keepalive); |
738 end | 744 end |