Mercurial > prosody-hg
comparison net/server_event.lua @ 3000:43a4cb707fe4
net.server_select, net.server_event: Support for :pause() and :resume() on connections
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Wed, 05 May 2010 15:21:17 +0100 |
| parents | 0c61f73ac0fb |
| children | fa00c6f563b4 |
comparison
equal
deleted
inserted
replaced
| 2988:0c61f73ac0fb | 3000:43a4cb707fe4 |
|---|---|
| 280 function interface_mt:_lock(nointerface, noreading, nowriting) -- lock or unlock this interface or events | 280 function interface_mt:_lock(nointerface, noreading, nowriting) -- lock or unlock this interface or events |
| 281 self.nointerface, self.noreading, self.nowriting = nointerface, noreading, nowriting | 281 self.nointerface, self.noreading, self.nowriting = nointerface, noreading, nowriting |
| 282 return nointerface, noreading, nowriting | 282 return nointerface, noreading, nowriting |
| 283 end | 283 end |
| 284 | 284 |
| 285 --TODO: Deprecate | |
| 285 function interface_mt:lock_read(switch) | 286 function interface_mt:lock_read(switch) |
| 286 return self:_lock(self.nointerface, switch, self.nowriting); | 287 if switch then |
| 288 return self:pause(); | |
| 289 else | |
| 290 return self:resume(); | |
| 291 end | |
| 292 end | |
| 293 | |
| 294 function interface_mt:pause() | |
| 295 return self:_lock(self.nointerface, true, self.nowriting); | |
| 296 end | |
| 297 | |
| 298 function interface_mt:resume() | |
| 299 return self:_lock(self.nointerface, false, self.nowriting); | |
| 287 end | 300 end |
| 288 | 301 |
| 289 function interface_mt:counter(c) | 302 function interface_mt:counter(c) |
| 290 if c then | 303 if c then |
| 291 self._connections = self._connections + c | 304 self._connections = self._connections + c |
