Software /
code /
prosody
Comparison
net/server_epoll.lua @ 7657:252823632401
net.server_epoll: Support for setting configuration parameters
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 04 Sep 2016 17:16:46 +0200 |
parent | 7637:cccea9136b2d |
child | 7658:e14a124c4d73 |
comparison
equal
deleted
inserted
replaced
7656:296543556065 | 7657:252823632401 |
---|---|
24 | 24 |
25 assert(socket.tcp6 and socket.tcp4, "Incompatible LuaSocket version"); | 25 assert(socket.tcp6 and socket.tcp4, "Incompatible LuaSocket version"); |
26 | 26 |
27 local _ENV = nil; | 27 local _ENV = nil; |
28 | 28 |
29 local cfg = { | 29 local default_config = { __index = { |
30 read_timeout = 900; | 30 read_timeout = 900; |
31 write_timeout = 7; | 31 write_timeout = 7; |
32 tcp_backlog = 128; | 32 tcp_backlog = 128; |
33 accept_retry_interval = 10; | 33 accept_retry_interval = 10; |
34 read_retry_delay = 1e-06; | 34 read_retry_delay = 1e-06; |
35 connect_timeout = 20; | 35 connect_timeout = 20; |
36 handshake_timeout = 60; | 36 handshake_timeout = 60; |
37 max_wait = 86400; | 37 max_wait = 86400; |
38 }; | 38 }}; |
39 local cfg = default_config.__index; | |
39 | 40 |
40 local fds = createtable(10, 0); -- FD -> conn | 41 local fds = createtable(10, 0); -- FD -> conn |
41 | 42 |
42 -- Timer and scheduling -- | 43 -- Timer and scheduling -- |
43 | 44 |
631 at = at; | 632 at = at; |
632 loop = loop; | 633 loop = loop; |
633 setquitting = setquitting; | 634 setquitting = setquitting; |
634 wrapclient = wrapclient; | 635 wrapclient = wrapclient; |
635 link = link; | 636 link = link; |
637 set_config = function (newconfig) | |
638 cfg = setmetatable(newconfig, default_config); | |
639 end; | |
636 | 640 |
637 -- libevent emulation | 641 -- libevent emulation |
638 event = { EV_READ = "r", EV_WRITE = "w", EV_READWRITE = "rw", EV_LEAVE = -1 }; | 642 event = { EV_READ = "r", EV_WRITE = "w", EV_READWRITE = "rw", EV_LEAVE = -1 }; |
639 addevent = function (fd, mode, callback) | 643 addevent = function (fd, mode, callback) |
640 local function onevent(self) | 644 local function onevent(self) |