Comparison

net/server_event.lua @ 9581:1be99aedb0b3

net.server: Add an API for holding writes of outgoing data
author Kim Alvefur <zash@zash.se>
date Thu, 25 Oct 2018 15:12:59 +0200
parent 9575:1fb3e7c550bf
child 9835:20bf5b47c1fb
comparison
equal deleted inserted replaced
9580:5fe91bfb734c 9581:1be99aedb0b3
270 if self.readcallback and not self.eventread then 270 if self.readcallback and not self.eventread then
271 self.eventread = addevent( base, self.conn, EV_READ, self.readcallback, cfg.READ_TIMEOUT ); -- register callback 271 self.eventread = addevent( base, self.conn, EV_READ, self.readcallback, cfg.READ_TIMEOUT ); -- register callback
272 return true; 272 return true;
273 end 273 end
274 end 274 end
275
276 function interface_mt:pause_writes()
277 return self:_lock(self.nointerface, self.noreading, true);
278 end
279
280 function interface_mt:resume_writes()
281 self:_lock(self.nointerface, self.noreading, false);
282 if self.writecallback and not self.eventwrite then
283 self.eventwrite = addevent( base, self.conn, EV_WRITE, self.writecallback, cfg.WRITE_TIMEOUT ); -- register callback
284 return true;
285 end
286 end
287
275 288
276 function interface_mt:counter(c) 289 function interface_mt:counter(c)
277 if c then 290 if c then
278 self._connections = self._connections + c 291 self._connections = self._connections + c
279 end 292 end