From 46c6ab5be36c3b0e245fb068f39a61db7a57d30e Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 18 Aug 2016 16:33:12 +0200 Subject: net.server_epoll: Additional logging of connects and TLS --- net/server_epoll.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/net/server_epoll.lua b/net/server_epoll.lua index 99561c18..62fb9863 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -337,7 +337,7 @@ function interface:close() log("debug", "Close %s after writing", tostring(self)); self._toclose = true; else - log("debug", "Close %s", tostring(self)); + log("debug", "Close %s now", tostring(self)); self.close = noop; self:on("disconnect"); self:destroy(); @@ -359,8 +359,10 @@ end function interface:starttls(ctx) if ctx then self.tls = ctx; end if self.writebuffer and self.writebuffer[1] then + log("debug", "Start TLS on %s after write", tostring(self)); self._starttls = true; else + log("debug", "Start TLS on %s now", tostring(self)); self:setflags(false, false); local conn, err = luasec.wrap(self.conn, ctx or self.tls); if not conn then @@ -379,6 +381,7 @@ end function interface:tlshandskake() local ok, err = self.conn:dohandshake(); if ok then + log("debug", "TLS handshake on %s complete", tostring(self)); self.onwriteable = nil; self.onreadable = nil; self:setflags(true, true); @@ -391,14 +394,17 @@ function interface:tlshandskake() self:on("status", "ssl-handshake-complete"); end elseif err == "wantread" then + log("debug", "TLS handshake on %s to wait until readable", tostring(self)); self:setflags(true, false); self:setwritetimeout(false); self:setreadtimeout(cfg.handshake_timeout); elseif err == "wantwrite" then + log("debug", "TLS handshake on %s to wait until writable", tostring(self)); self:setflags(false, true); self:setreadtimeout(false); self:setwritetimeout(cfg.handshake_timeout); else + log("debug", "TLS handshake error on %s: %s", tostring(self), err); self:on("disconnect", err); self:destroy(); end @@ -436,6 +442,7 @@ function interface:onacceptable() return; end local client = wrapsocket(conn, self, nil, self.listeners, self.tls); + log("debug", "New connection %s", tostring(client)); if self.tls then client._tls = false; client:starttls(); -- cgit v1.2.3