diff options
author | Kim Alvefur <zash@zash.se> | 2018-10-12 03:20:09 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-10-12 03:20:09 +0200 |
commit | bbf669b2c5e22279075dfaec14dcc389cc364c7a (patch) | |
tree | 4571d78b3e61ea7756150d06476858aa67cc8aa3 /net | |
parent | ba2688c78d1c6c7e092b6994b01e61fb1eaf34df (diff) | |
download | prosody-bbf669b2c5e22279075dfaec14dcc389cc364c7a.tar.gz prosody-bbf669b2c5e22279075dfaec14dcc389cc364c7a.zip |
net.server_epoll: Graceful handling of registering already added socket
Diffstat (limited to 'net')
-rw-r--r-- | net/server_epoll.lua | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua index e0189179..fc939675 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -25,7 +25,10 @@ local inet = require "util.net"; local inet_pton = inet.pton; local _SOCKETINVALID = socket._SOCKETINVALID or -1; -local poll = assert(require "util.poll".new()); +local poller = require "util.poll" +local EEXIST = poller.EEXIST; + +local poll = assert(poller.new()); local _ENV = nil; -- luacheck: std none @@ -269,6 +272,10 @@ function interface:add(r, w) if w == nil then w = self._wantwrite; end local ok, err, errno = poll:add(fd, r, w); if not ok then + if errno == EEXIST then + log("debug", "%s already registered!", self); + return self:set(r, w); -- So try to change its flags + end log("error", "Could not register %s: %s(%d)", self, err, errno); return ok, err; end |