Comparison

net/server_epoll.lua @ 9933:aac4c55721f9

Merge 0.11->trunk
author Kim Alvefur <zash@zash.se>
date Thu, 28 Mar 2019 17:28:20 +0100
parent 9855:6c2370f17027
parent 9932:df73ca804719
child 9995:8d46ecc4bd0c
comparison
equal deleted inserted replaced
9930:12a31296d63d 9933:aac4c55721f9
338 local data, err, partial = self.conn:receive(self.read_size or cfg.read_size); 338 local data, err, partial = self.conn:receive(self.read_size or cfg.read_size);
339 if data then 339 if data then
340 self:onconnect(); 340 self:onconnect();
341 self:on("incoming", data); 341 self:on("incoming", data);
342 else 342 else
343 if err == "wantread" then
344 self:set(true, nil);
345 err = "timeout";
346 elseif err == "wantwrite" then
347 self:set(nil, true);
348 err = "timeout";
349 end
343 if partial and partial ~= "" then 350 if partial and partial ~= "" then
344 self:onconnect(); 351 self:onconnect();
345 self:on("incoming", partial, err); 352 self:on("incoming", partial, err);
346 end 353 end
347 if err == "wantread" then 354 if err ~= "timeout" then
348 self:set(true, nil);
349 elseif err == "wantwrite" then
350 self:set(nil, true);
351 elseif err ~= "timeout" then
352 self:on("disconnect", err); 355 self:on("disconnect", err);
353 self:destroy() 356 self:destroy()
354 return; 357 return;
355 end 358 end
356 end 359 end
357 if not self.conn then return; end 360 if not self.conn then return; end
358 if self.conn:dirty() then 361 if self._wantread and self.conn:dirty() then
359 self:setreadtimeout(false); 362 self:setreadtimeout(false);
360 self:pausefor(cfg.read_retry_delay); 363 self:pausefor(cfg.read_retry_delay);
361 else 364 else
362 self:setreadtimeout(); 365 self:setreadtimeout();
363 end 366 end