Comparison

net/server_epoll.lua @ 8776:e7d4344e0fea

net.server_epoll: Handle connection being closed and destroyed in onconnect callback
author Kim Alvefur <zash@zash.se>
date Wed, 02 May 2018 19:20:29 +0200
parent 8555:4f0f5b49bb03
child 8777:2bfe963f3041
comparison
equal deleted inserted replaced
8775:ae7cf011e46a 8776:e7d4344e0fea
334 end 334 end
335 335
336 -- Called when socket is writable 336 -- Called when socket is writable
337 function interface:onwritable() 337 function interface:onwritable()
338 self:onconnect(); 338 self:onconnect();
339 if not self.conn then return; end -- could have been closed in onconnect
339 local buffer = self.writebuffer; 340 local buffer = self.writebuffer;
340 local data = t_concat(buffer); 341 local data = t_concat(buffer);
341 local ok, err, partial = self.conn:send(data); 342 local ok, err, partial = self.conn:send(data);
342 if ok then 343 if ok then
343 self:setflags(nil, false); 344 self:setflags(nil, false);