Comparison

net/server_epoll.lua @ 8542:8c39ec8e6018

net.server_epoll: Spelling writeable -> writable
author Kim Alvefur <zash@zash.se>
date Sat, 24 Feb 2018 14:39:36 +0100
parent 8541:8186114329d6
child 8552:1fcefc16a55d
comparison
equal deleted inserted replaced
8541:8186114329d6 8542:8c39ec8e6018
331 self:setreadtimeout(); 331 self:setreadtimeout();
332 end 332 end
333 end 333 end
334 334
335 -- Called when socket is writable 335 -- Called when socket is writable
336 function interface:onwriteable() 336 function interface:onwritable()
337 local buffer = self.writebuffer; 337 local buffer = self.writebuffer;
338 local data = t_concat(buffer); 338 local data = t_concat(buffer);
339 local ok, err, partial = self.conn:send(data); 339 local ok, err, partial = self.conn:send(data);
340 if ok then 340 if ok then
341 self:setflags(nil, false); 341 self:setflags(nil, false);
401 function interface:destroy() 401 function interface:destroy()
402 self:setflags(false, false); 402 self:setflags(false, false);
403 self:setwritetimeout(false); 403 self:setwritetimeout(false);
404 self:setreadtimeout(false); 404 self:setreadtimeout(false);
405 self.onreadable = noop; 405 self.onreadable = noop;
406 self.onwriteable = noop; 406 self.onwritable = noop;
407 self.destroy = noop; 407 self.destroy = noop;
408 self.close = noop; 408 self.close = noop;
409 self.on = noop; 409 self.on = noop;
410 self.conn:close(); 410 self.conn:close();
411 self.conn = nil; 411 self.conn = nil;
432 return conn, err; 432 return conn, err;
433 end 433 end
434 conn:settimeout(0); 434 conn:settimeout(0);
435 self.conn = conn; 435 self.conn = conn;
436 self.ondrain = nil; 436 self.ondrain = nil;
437 self.onwriteable = interface.tlshandskake; 437 self.onwritable = interface.tlshandskake;
438 self.onreadable = interface.tlshandskake; 438 self.onreadable = interface.tlshandskake;
439 self:setflags(true, true); 439 self:setflags(true, true);
440 self:setwritetimeout(cfg.handshake_timeout); 440 self:setwritetimeout(cfg.handshake_timeout);
441 end 441 end
442 end 442 end
445 self:setwritetimeout(false); 445 self:setwritetimeout(false);
446 self:setreadtimeout(false); 446 self:setreadtimeout(false);
447 local ok, err = self.conn:dohandshake(); 447 local ok, err = self.conn:dohandshake();
448 if ok then 448 if ok then
449 log("debug", "TLS handshake on %s complete", tostring(self)); 449 log("debug", "TLS handshake on %s complete", tostring(self));
450 self.onwriteable = nil; 450 self.onwritable = nil;
451 self.onreadable = nil; 451 self.onreadable = nil;
452 self._tls = true; 452 self._tls = true;
453 self:on("status", "ssl-handshake-complete"); 453 self:on("status", "ssl-handshake-complete");
454 self:init(); 454 self:init();
455 elseif err == "wantread" then 455 elseif err == "wantread" then
633 if conn then 633 if conn then
634 if r then 634 if r then
635 conn:onreadable(); 635 conn:onreadable();
636 end 636 end
637 if w then 637 if w then
638 conn:onwriteable(); 638 conn:onwritable();
639 end 639 end
640 else 640 else
641 log("debug", "Removing unknown fd %d", fd); 641 log("debug", "Removing unknown fd %d", fd);
642 epoll.ctl("del", fd); 642 epoll.ctl("del", fd);
643 end 643 end
677 677
678 local conn = setmetatable({ 678 local conn = setmetatable({
679 getfd = function () return fd; end; 679 getfd = function () return fd; end;
680 callback = callback; 680 callback = callback;
681 onreadable = onevent; 681 onreadable = onevent;
682 onwriteable = onevent; 682 onwritable = onevent;
683 close = function (self) 683 close = function (self)
684 self:setflags(false, false); 684 self:setflags(false, false);
685 fds[fd] = nil; 685 fds[fd] = nil;
686 end; 686 end;
687 }, interface_mt); 687 }, interface_mt);