Comparison

net/server_epoll.lua @ 10419:3b9d17c234df

Back out c8aa66595072: Extra changes accidentally included
author Kim Alvefur <zash@zash.se>
date Sun, 17 Nov 2019 23:45:44 +0100
parent 10418:c8aa66595072
child 10420:49a828819696
comparison
equal deleted inserted replaced
10418:c8aa66595072 10419:3b9d17c234df
381 self:onconnect(); 381 self:onconnect();
382 self:onincoming(partial, err); 382 self:onincoming(partial, err);
383 end 383 end
384 if err ~= "timeout" then 384 if err ~= "timeout" then
385 self:on("disconnect", err); 385 self:on("disconnect", err);
386 self:close() 386 self:destroy()
387 return; 387 return;
388 end 388 end
389 end 389 end
390 if not self.conn then return; end 390 if not self.conn then return; end
391 if self._limit and (data or partial) then 391 if self._limit and (data or partial) then
800 conn.getfd = function () 800 conn.getfd = function ()
801 return fd; 801 return fd;
802 end; 802 end;
803 -- Otherwise it'll need to be something LuaSocket-compatible 803 -- Otherwise it'll need to be something LuaSocket-compatible
804 end 804 end
805 conn.id = new_id(); 805 conn.log = logger.init(("fdwatch%s"):format(new_id()));
806 conn.log = logger.init(("fdwatch%s"):format(conn.id));
807 conn:add(onreadable, onwritable); 806 conn:add(onreadable, onwritable);
808 return conn; 807 return conn;
809 end; 808 end;
810 809
811 -- Dump all data from one connection into another 810 -- Dump all data from one connection into another
910 close = function (self) 909 close = function (self)
911 self:del(); 910 self:del();
912 fds[fd] = nil; 911 fds[fd] = nil;
913 end; 912 end;
914 }, interface_mt); 913 }, interface_mt);
915 conn.id = conn:getfd(); 914 conn.log = logger.init(("fdwatch%d"):format(conn:getfd()));
916 conn.log = logger.init(("fdwatch%d"):format(conn.id));
917 local ok, err = conn:add(mode == "r" or mode == "rw", mode == "w" or mode == "rw"); 915 local ok, err = conn:add(mode == "r" or mode == "rw", mode == "w" or mode == "rw");
918 if not ok then return ok, err; end 916 if not ok then return ok, err; end
919 return conn; 917 return conn;
920 end; 918 end;
921 }; 919 };