Software /
code /
prosody
Comparison
net/server_epoll.lua @ 9320:8cc498cb0df7
net.server_epoll: Add back setflags API for compat
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 15 Sep 2018 14:24:09 +0200 |
parent | 9319:7c954c75b6ac |
child | 9321:146dc1e4c7ff |
comparison
equal
deleted
inserted
replaced
9319:7c954c75b6ac | 9320:8cc498cb0df7 |
---|---|
306 end | 306 end |
307 self._wantread, self._wantwrite = nil, nil; | 307 self._wantread, self._wantwrite = nil, nil; |
308 fds[fd] = nil; | 308 fds[fd] = nil; |
309 log("debug", "Unregistered %s", self); | 309 log("debug", "Unregistered %s", self); |
310 return true; | 310 return true; |
311 end | |
312 | |
313 function interface:setflags(r, w) | |
314 if not(self._wantread or self._wantwrite) then | |
315 if not(r or w) then | |
316 return true; -- no change | |
317 end | |
318 return self:add(r, w); | |
319 end | |
320 if not(r or w) then | |
321 return self:del(); | |
322 end | |
323 return self:set(r, w); | |
311 end | 324 end |
312 | 325 |
313 -- Called when socket is readable | 326 -- Called when socket is readable |
314 function interface:onreadable() | 327 function interface:onreadable() |
315 local data, err, partial = self.conn:receive(self.read_size or cfg.read_size); | 328 local data, err, partial = self.conn:receive(self.read_size or cfg.read_size); |