Comparison

net/server_epoll.lua @ 7795:03081bd5c5bb

net.server_epoll: Add the 'once' argument to loop for parity with server_select
author Kim Alvefur <zash@zash.se>
date Sun, 01 Jan 2017 19:32:54 +0100
parent 7794:424bbbeb9257
child 7796:12609aee3b3b
comparison
equal deleted inserted replaced
7794:424bbbeb9257 7795:03081bd5c5bb
615 local function setquitting() 615 local function setquitting()
616 quitting = "quitting"; 616 quitting = "quitting";
617 end 617 end
618 618
619 -- Main loop 619 -- Main loop
620 local function loop() 620 local function loop(once)
621 repeat 621 repeat
622 local t = runtimers(cfg.max_wait, cfg.min_wait); 622 local t = runtimers(cfg.max_wait, cfg.min_wait);
623 local fd, r, w = epoll.wait(t); 623 local fd, r, w = epoll.wait(t);
624 if fd then 624 if fd then
625 local conn = fds[fd]; 625 local conn = fds[fd];
635 epoll.ctl("del", fd); 635 epoll.ctl("del", fd);
636 end 636 end
637 elseif r ~= "timeout" then 637 elseif r ~= "timeout" then
638 log("debug", "epoll_wait error: %s", tostring(r)); 638 log("debug", "epoll_wait error: %s", tostring(r));
639 end 639 end
640 until quitting; 640 until once or quitting;
641 return quitting; 641 return quitting;
642 end 642 end
643 643
644 return { 644 return {
645 get_backend = function () return "epoll"; end; 645 get_backend = function () return "epoll"; end;