Software /
code /
prosody
Comparison
net/server_epoll.lua @ 7559:b1b27dedf4cf
net.server_epoll: Replace any previous pausefor timer
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 12 Aug 2016 01:11:59 +0200 |
parent | 7558:3a2fe8e10eeb |
child | 7560:785fa1138293 |
comparison
equal
deleted
inserted
replaced
7558:3a2fe8e10eeb | 7559:b1b27dedf4cf |
---|---|
410 function interface:resume() | 410 function interface:resume() |
411 self:setflags(true); | 411 self:setflags(true); |
412 end | 412 end |
413 | 413 |
414 function interface:pausefor(t) | 414 function interface:pausefor(t) |
415 if self._wantread then | 415 if self._pausefor then |
416 self:setflags(false); | 416 self._pausefor:close(); |
417 addtimer(t, function () self:setflags(true); end); | 417 end |
418 end | 418 if t == false then return; end |
419 self:setflags(false); | |
420 self._pausefor = addtimer(t, function () | |
421 self._pausefor = nil; | |
422 self:setflags(true); | |
423 end); | |
419 end | 424 end |
420 | 425 |
421 function interface:onconnect() | 426 function interface:onconnect() |
422 self.onwriteable = nil; | 427 self.onwriteable = nil; |
423 self.listeners.onconnect(self); | 428 self.listeners.onconnect(self); |