Comparison

net/server_epoll.lua @ 11699:1275dad71afd

net.server_epoll: Use only fatal "write" timeout during TLS negotiation Only real difference between the read and write timeouts is that the former has a callback that allows the higher levels to keep the connection alive, while hitting the later is immediately fatal. We want the later behavior for TLS negotiation.
author Kim Alvefur <zash@zash.se>
date Fri, 16 Jul 2021 17:10:09 +0200
parent 11698:9a2a98621c73
child 11700:79d30de13fdb
comparison
equal deleted inserted replaced
11698:9a2a98621c73 11699:1275dad71afd
598 self.ondrain = nil; 598 self.ondrain = nil;
599 end 599 end
600 self.onwritable = interface.inittls; 600 self.onwritable = interface.inittls;
601 self.onreadable = interface.inittls; 601 self.onreadable = interface.inittls;
602 self:set(true, true); 602 self:set(true, true);
603 self:setreadtimeout(cfg.ssl_handshake_timeout); 603 self:setreadtimeout(false);
604 self:setwritetimeout(cfg.ssl_handshake_timeout); 604 self:setwritetimeout(cfg.ssl_handshake_timeout);
605 self:debug("Prepared to start TLS"); 605 self:debug("Prepared to start TLS");
606 end 606 end
607 end 607 end
608 608
649 self.onwritable = interface.tlshandshake; 649 self.onwritable = interface.tlshandshake;
650 self.onreadable = interface.tlshandshake; 650 self.onreadable = interface.tlshandshake;
651 if now then 651 if now then
652 return self:tlshandshake() 652 return self:tlshandshake()
653 end 653 end
654 self:setreadtimeout(cfg.ssl_handshake_timeout); 654 self:setreadtimeout(false);
655 self:setwritetimeout(cfg.ssl_handshake_timeout); 655 self:setwritetimeout(cfg.ssl_handshake_timeout);
656 self:set(true, true); 656 self:set(true, true);
657 end 657 end
658 658
659 function interface:tlshandshake() 659 function interface:tlshandshake()
675 self:onconnect(); 675 self:onconnect();
676 self:onreadable(); 676 self:onreadable();
677 elseif err == "wantread" then 677 elseif err == "wantread" then
678 self:noise("TLS handshake to wait until readable"); 678 self:noise("TLS handshake to wait until readable");
679 self:set(true, false); 679 self:set(true, false);
680 self:setreadtimeout(cfg.ssl_handshake_timeout); 680 self:setwritetimeout(cfg.ssl_handshake_timeout);
681 elseif err == "wantwrite" then 681 elseif err == "wantwrite" then
682 self:noise("TLS handshake to wait until writable"); 682 self:noise("TLS handshake to wait until writable");
683 self:set(false, true); 683 self:set(false, true);
684 self:setwritetimeout(cfg.ssl_handshake_timeout); 684 self:setwritetimeout(cfg.ssl_handshake_timeout);
685 else 685 else