Changeset

741:97577b6c07ca

server.lua: Comment out unnecessary or very verbose logging, and log the rest as debug level
author Matthew Wild <mwild1@gmail.com>
date Sat, 17 Jan 2009 14:57:21 +0000
parents 740:cc25d75b4027
children 742:b9f59372eb4e
files net/server.lua
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/net/server.lua	Sat Jan 17 14:53:20 2009 +0000
+++ b/net/server.lua	Sat Jan 17 14:57:21 2009 +0000
@@ -19,7 +19,7 @@
 end
 
 local log, table_concat = require ("util.logger").init("socket"), table.concat;
-local out_put = function () end
+local out_put = function (...) return log("debug", table_concat{...}); end
 local out_error = function (...) return log("warn", table_concat{...}); end
 local mem_free = collectgarbage
 
@@ -433,7 +433,7 @@
             readtraffic = readtraffic + count
             _readtraffic = _readtraffic + count
             _readtimes[ handler ] = _currenttime
-            out_put( "server.lua: read data '", buffer, "', error: ", err )
+            --out_put( "server.lua: read data '", buffer, "', error: ", err )
             return dispatch( handler, buffer, err )
         else    -- connections was closed or fatal error
             out_put( "server.lua: client ", ip, ":", clientport, " error: ", err )
@@ -450,7 +450,7 @@
         sendtraffic = sendtraffic + count
         _sendtraffic = _sendtraffic + count
         _ = _cleanqueue and clean( bufferqueue )
-        out_put( "server.lua: sended '", buffer, "', bytes: ", succ, ", error: ", err, ", part: ", byte, ", to: ", ip, ":", clientport )
+        --out_put( "server.lua: sended '", buffer, "', bytes: ", succ, ", error: ", err, ", part: ", byte, ", to: ", ip, ":", clientport )
         if succ then    -- sending succesful
             bufferqueuelen = 0
             bufferlen = 0
@@ -483,7 +483,7 @@
                 for i = 1, 10 do    -- 10 handshake attemps
                     _, err = client:dohandshake( )
                     if not err then
-                        out_put( "server.lua: ssl handshake done" )
+                        --out_put( "server.lua: ssl handshake done" )
                         _sendlistlen = ( wrote and removesocket( _sendlist, socket, _sendlistlen ) ) or _sendlistlen
                         handler.readbuffer = _readbuffer    -- when handshake is done, replace the handshake function with regular functions
                         handler.sendbuffer = _sendbuffer
@@ -506,7 +506,7 @@
             end
         )
         if startssl then    -- ssl now?
-            out_put("server.lua: ", "starting ssl handshake")
+            --out_put("server.lua: ", "starting ssl handshake")
 	    local err
             socket, err = ssl_wrap( socket, sslctx )    -- wrap socket
             if err then
@@ -521,14 +521,14 @@
         else
             handler.starttls = function( now )
                 if not now then
-                    out_put "server.lua: we need to do tls, but delaying until later"
+                    --out_put "server.lua: we need to do tls, but delaying until later"
                     needtls = true
                     return
                 end
-                out_put( "server.lua: attempting to start tls on " .. tostring( socket ) )
+                --out_put( "server.lua: attempting to start tls on " .. tostring( socket ) )
                 local oldsocket, err = socket
                 socket, err = ssl_wrap( socket, sslctx )    -- wrap socket
-                out_put( "server.lua: sslwrapped socket is " .. tostring( socket ) )
+                --out_put( "server.lua: sslwrapped socket is " .. tostring( socket ) )
                 if err then
                     out_put( "server.lua: error while starting tls on client: ", err )
                     return nil, err    -- fatal error
@@ -615,7 +615,7 @@
 
 addserver = function( listeners, port, addr, pattern, sslctx, maxconnections, startssl )    -- this function provides a way for other scripts to reg a server
     local err
-    out_put("server.lua: autossl on ", port, " is ", startssl)
+    --out_put("server.lua: autossl on ", port, " is ", startssl)
     if type( listeners ) ~= "table" then
         err = "invalid listener table"
     end