Software /
code /
prosody
Comparison
net/server_event.lua @ 7225:a74f0b7be6bf
Merge 0.10->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 02 Mar 2016 16:34:34 +0100 |
parent | 7042:20ac6972b9aa |
parent | 7224:07a4c807a94a |
child | 7338:f8d37227acd7 |
comparison
equal
deleted
inserted
replaced
7220:2156aee1233e | 7225:a74f0b7be6bf |
---|---|
236 interfacelist[ self ] = nil | 236 interfacelist[ self ] = nil |
237 return true | 237 return true |
238 end | 238 end |
239 | 239 |
240 function interface_mt:_lock(nointerface, noreading, nowriting) -- lock or unlock this interface or events | 240 function interface_mt:_lock(nointerface, noreading, nowriting) -- lock or unlock this interface or events |
241 self.nointerface, self.noreading, self.nowriting = nointerface, noreading, nowriting | 241 self.nointerface, self.noreading, self.nowriting = nointerface, noreading, nowriting |
242 return nointerface, noreading, nowriting | 242 return nointerface, noreading, nowriting |
243 end | 243 end |
244 | 244 |
245 --TODO: Deprecate | 245 --TODO: Deprecate |
246 function interface_mt:lock_read(switch) | 246 function interface_mt:lock_read(switch) |
247 if switch then | 247 if switch then |
255 return self:_lock(self.nointerface, true, self.nowriting); | 255 return self:_lock(self.nointerface, true, self.nowriting); |
256 end | 256 end |
257 | 257 |
258 function interface_mt:resume() | 258 function interface_mt:resume() |
259 self:_lock(self.nointerface, false, self.nowriting); | 259 self:_lock(self.nointerface, false, self.nowriting); |
260 if not self.eventread then | 260 if self.readcallback and not self.eventread then |
261 self.eventread = addevent( base, self.conn, EV_READ, self.readcallback, cfg.READ_TIMEOUT ); -- register callback | 261 self.eventread = addevent( base, self.conn, EV_READ, self.readcallback, cfg.READ_TIMEOUT ); -- register callback |
262 return true; | |
262 end | 263 end |
263 end | 264 end |
264 | 265 |
265 function interface_mt:counter(c) | 266 function interface_mt:counter(c) |
266 if c then | 267 if c then |
738 return "quitting"; | 739 return "quitting"; |
739 end | 740 end |
740 | 741 |
741 local function newevent( ... ) | 742 local function newevent( ... ) |
742 return addevent( base, ... ) | 743 return addevent( base, ... ) |
743 end | 744 end |
744 | 745 |
745 local function closeallservers ( arg ) | 746 local function closeallservers ( arg ) |
746 for item in pairs( interfacelist ) do | 747 for item in pairs( interfacelist ) do |
747 if item.type == "server" then | 748 if item.type == "server" then |
748 item:close( arg ) | 749 item:close( arg ) |
750 end | 751 end |
751 end | 752 end |
752 | 753 |
753 local function setquitting(yes) | 754 local function setquitting(yes) |
754 if yes then | 755 if yes then |
755 -- Quit now | 756 -- Quit now |
756 closeallservers(); | 757 closeallservers(); |
757 base:loopexit(); | 758 base:loopexit(); |
758 end | 759 end |
759 end | 760 end |
760 | 761 |
761 local function get_backend() | 762 local function get_backend() |
762 return base:method(); | 763 return base:method(); |