Comparison

net/server_epoll.lua @ 7593:0266434d7df1

net.server_epoll: Prevent further writing after closing a socket
author Kim Alvefur <zash@zash.se>
date Thu, 18 Aug 2016 16:41:22 +0200
parent 7592:10d2f008321d
child 7594:5e884501a9ac
comparison
equal deleted inserted replaced
7592:10d2f008321d 7593:0266434d7df1
332 end 332 end
333 interface.send = interface.write; 333 interface.send = interface.write;
334 334
335 function interface:close() 335 function interface:close()
336 if self._wantwrite then 336 if self._wantwrite then
337 self:setflags(false, true); -- Flush final buffer contents
338 self.write, self.send = noop, noop; -- No more writing
337 log("debug", "Close %s after writing", tostring(self)); 339 log("debug", "Close %s after writing", tostring(self));
338 self._toclose = true; 340 self._toclose = true;
339 else 341 else
340 log("debug", "Close %s now", tostring(self)); 342 log("debug", "Close %s now", tostring(self));
343 self.write, self.send = noop, noop;
341 self.close = noop; 344 self.close = noop;
342 self:on("disconnect"); 345 self:on("disconnect");
343 self:destroy(); 346 self:destroy();
344 end 347 end
345 end 348 end