Software / code / prosody
Comparison
net/server_epoll.lua @ 11812:42e98179c034
Merge 0.11->trunk
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 20 Sep 2021 15:51:43 +0200 |
| parent | 11805:2327e03d1f8d |
| parent | 11811:ae43166fe931 |
| child | 11813:790bffbb9047 |
comparison
equal
deleted
inserted
replaced
| 11808:c24580a214f3 | 11812:42e98179c034 |
|---|---|
| 87 -- Whether to let the Nagle algorithm stay enabled | 87 -- Whether to let the Nagle algorithm stay enabled |
| 88 nagle = true; | 88 nagle = true; |
| 89 | 89 |
| 90 -- Reuse write buffer tables | 90 -- Reuse write buffer tables |
| 91 keep_buffers = true; | 91 keep_buffers = true; |
| 92 | |
| 93 --- How long to wait after getting the shutdown signal before forcefully tearing down every socket | |
| 94 shutdown_deadline = 5; | |
| 92 }}; | 95 }}; |
| 93 local cfg = default_config.__index; | 96 local cfg = default_config.__index; |
| 94 | 97 |
| 95 local fds = createtable(10, 0); -- FD -> conn | 98 local fds = createtable(10, 0); -- FD -> conn |
| 96 | 99 |
| 1002 -- Signal main loop about shutdown via above upvalue | 1005 -- Signal main loop about shutdown via above upvalue |
| 1003 local function setquitting(quit) | 1006 local function setquitting(quit) |
| 1004 if quit then | 1007 if quit then |
| 1005 quitting = "quitting"; | 1008 quitting = "quitting"; |
| 1006 closeall(); | 1009 closeall(); |
| 1010 addtimer(1, function () | |
| 1011 if quitting then | |
| 1012 closeall(); | |
| 1013 return 1; | |
| 1014 end | |
| 1015 end); | |
| 1016 if cfg.shutdown_deadline then | |
| 1017 addtimer(cfg.shutdown_deadline, function () | |
| 1018 if quitting then | |
| 1019 for fd, conn in pairs(fds) do -- luacheck: ignore 213/fd | |
| 1020 conn:destroy(); | |
| 1021 end | |
| 1022 end | |
| 1023 end); | |
| 1024 end | |
| 1007 else | 1025 else |
| 1008 quitting = nil; | 1026 quitting = nil; |
| 1009 end | 1027 end |
| 1010 end | 1028 end |
| 1011 | 1029 |