Software /
code /
prosody
Diff
net/server_event.lua @ 4468:938d878d8087
net.server_event: Fix :pause() to actually stop reading from the socket, rather than ignoring socket-readable events (!), and :resume() to restart the event listener
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 16 Jan 2012 04:44:23 +0000 |
parent | 4399:1b4161970842 |
child | 4676:1ce2ff9ec313 |
line wrap: on
line diff
--- a/net/server_event.lua Fri Jan 13 23:30:32 2012 +0000 +++ b/net/server_event.lua Mon Jan 16 04:44:23 2012 +0000 @@ -295,7 +295,10 @@ end function interface_mt:resume() - return self:_lock(self.nointerface, false, self.nowriting); + self:_lock(self.nointerface, false, self.nowriting); + if not self.eventread then + self.eventread = addevent( base, self.conn, EV_READ, self.readcallback, cfg.READ_TIMEOUT ); -- register callback + end end function interface_mt:counter(c) @@ -642,6 +645,10 @@ return -1 end end + if interface.noreading then + interface.eventread = nil; + return -1; + end return EV_READ, cfg.READ_TIMEOUT end end