Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
4467:fc8a22936b3c | 4468:938d878d8087 |
---|---|
293 function interface_mt:pause() | 293 function interface_mt:pause() |
294 return self:_lock(self.nointerface, true, self.nowriting); | 294 return self:_lock(self.nointerface, true, self.nowriting); |
295 end | 295 end |
296 | 296 |
297 function interface_mt:resume() | 297 function interface_mt:resume() |
298 return self:_lock(self.nointerface, false, self.nowriting); | 298 self:_lock(self.nointerface, false, self.nowriting); |
299 if not self.eventread then | |
300 self.eventread = addevent( base, self.conn, EV_READ, self.readcallback, cfg.READ_TIMEOUT ); -- register callback | |
301 end | |
299 end | 302 end |
300 | 303 |
301 function interface_mt:counter(c) | 304 function interface_mt:counter(c) |
302 if c then | 305 if c then |
303 self._connections = self._connections + c | 306 self._connections = self._connections + c |
640 interface:_close() | 643 interface:_close() |
641 interface.eventread = nil | 644 interface.eventread = nil |
642 return -1 | 645 return -1 |
643 end | 646 end |
644 end | 647 end |
648 if interface.noreading then | |
649 interface.eventread = nil; | |
650 return -1; | |
651 end | |
645 return EV_READ, cfg.READ_TIMEOUT | 652 return EV_READ, cfg.READ_TIMEOUT |
646 end | 653 end |
647 end | 654 end |
648 | 655 |
649 client:settimeout( 0 ) -- set non blocking | 656 client:settimeout( 0 ) -- set non blocking |