Comparison

net/server_epoll.lua @ 7564:f95ffd24e042

net.server_epoll: Clear write flag before calling ondrain, fixes calling of ondisconnect on explicit close
author Kim Alvefur <zash@zash.se>
date Tue, 16 Aug 2016 14:53:29 +0200
parent 7563:71dc0d89a9b8
child 7573:0f0a6febbc5a
comparison
equal deleted inserted replaced
7563:71dc0d89a9b8 7564:f95ffd24e042
248 local ok, err, partial = self.conn:send(data); 248 local ok, err, partial = self.conn:send(data);
249 if ok then 249 if ok then
250 for i = #buffer, 1, -1 do 250 for i = #buffer, 1, -1 do
251 buffer[i] = nil; 251 buffer[i] = nil;
252 end 252 end
253 self:ondrain(); 253 self:setflags(nil, false);
254 if not buffer[1] then 254 self:setwritetimeout(false);
255 self:setflags(nil, false); 255 self:ondrain(); -- Be aware of writes in ondrain
256 self:setwritetimeout(false);
257 else
258 self:setwritetimeout();
259 end
260 elseif partial then 256 elseif partial then
261 buffer[1] = data:sub(partial+1) 257 buffer[1] = data:sub(partial+1)
262 for i = #buffer, 2, -1 do 258 for i = #buffer, 2, -1 do
263 buffer[i] = nil; 259 buffer[i] = nil;
264 end 260 end