Comparison

net/server_epoll.lua @ 8007:67f8954875a4

net.server_epoll: Check write buffer for remaining data to write when closing
author Kim Alvefur <zash@zash.se>
date Mon, 27 Mar 2017 03:41:24 +0200
parent 8006:be374a5778f3
child 8008:62ed3795be13
comparison
equal deleted inserted replaced
8006:be374a5778f3 8007:67f8954875a4
382 end 382 end
383 interface.send = interface.write; 383 interface.send = interface.write;
384 384
385 -- Close, possibly after writing is done 385 -- Close, possibly after writing is done
386 function interface:close() 386 function interface:close()
387 if self._wantwrite then 387 if self.writebuffer and self.writebuffer[1] then
388 self:setflags(false, true); -- Flush final buffer contents 388 self:setflags(false, true); -- Flush final buffer contents
389 self.write, self.send = noop, noop; -- No more writing 389 self.write, self.send = noop, noop; -- No more writing
390 log("debug", "Close %s after writing", tostring(self)); 390 log("debug", "Close %s after writing", tostring(self));
391 self._toclose = true; 391 self._toclose = true;
392 else 392 else