@@ -379,17 +379,17 @@ function listenloop(
379
379
conns_lock, verbose
380
380
)
381
381
sem = Base. Semaphore (max_connections)
382
- verbose >= 0 && @infov 1 " Listening on: $(listener. hostname) :$(listener. hostport) , thread id: $(Threads. threadid ()) "
382
+ verbose >= 0 && @info " Listening on: $(listener. hostname) :$(listener. hostport) , thread id: $(Threads. threadid ()) "
383
383
notify (ready_to_accept)
384
384
while isopen (listener)
385
385
try
386
386
Base. acquire (sem)
387
387
io = accept (listener)
388
388
if io === nothing
389
- @warnv 1 " unable to accept new connection"
389
+ verbose >= 0 && @warn " unable to accept new connection"
390
390
continue
391
391
elseif ! tcpisvalid (io)
392
- @warnv 1 " !tcpisvalid: $io "
392
+ verbose >= 0 && @warn " !tcpisvalid: $io "
393
393
close (io)
394
394
continue
395
395
end
@@ -398,17 +398,17 @@ function listenloop(
398
398
Base. @lock conns_lock push! (conns, conn)
399
399
conn. host, conn. port = listener. hostname, listener. hostport
400
400
@async try
401
- handle_connection (f, conn, listener, readtimeout, access_log)
401
+ handle_connection (f, conn, listener, readtimeout, access_log, verbose )
402
402
finally
403
403
# handle_connection is in charge of closing the underlying io
404
404
Base. @lock conns_lock delete! (conns, conn)
405
405
Base. release (sem)
406
406
end
407
407
catch e
408
408
if e isa Base. IOError && e. code == Base. UV_ECONNABORTED
409
- verbose >= 0 && @infov 1 " Server on $(listener. hostname) :$(listener. hostport) closing"
409
+ verbose >= 0 && @info " Server on $(listener. hostname) :$(listener. hostport) closing"
410
410
else
411
- @errorv 2 begin
411
+ verbose >= 1 && @error begin
412
412
msg = current_exceptions_to_string ()
413
413
" Server on $(listener. hostname) :$(listener. hostport) errored. $msg "
414
414
end
@@ -428,10 +428,10 @@ for each HTTP Request received.
428
428
After `reuse_limit + 1` transactions, signal `final_transaction` to the
429
429
transaction handler, which will close the connection.
430
430
"""
431
- function handle_connection (f, c:: Connection , listener, readtimeout, access_log)
431
+ function handle_connection (f, c:: Connection , listener, readtimeout, access_log, verbose )
432
432
wait_for_timeout = Ref {Bool} (true )
433
433
if readtimeout > 0
434
- @async check_readtimeout (c, readtimeout, wait_for_timeout)
434
+ @async check_readtimeout (c, readtimeout, wait_for_timeout, verbose )
435
435
end
436
436
try
437
437
# if the connection socket or listener close, we stop taking requests
@@ -499,7 +499,7 @@ function handle_connection(f, c::Connection, listener, readtimeout, access_log)
499
499
end
500
500
catch
501
501
# we should be catching everything inside the while loop, but just in case
502
- @errorv 1 begin
502
+ verbose >= 0 && @error begin
503
503
msg = current_exceptions_to_string ()
504
504
" error while handling connection. $msg "
505
505
end
@@ -516,10 +516,10 @@ end
516
516
"""
517
517
If `c` is inactive for a more than `readtimeout` then close the `c`."
518
518
"""
519
- function check_readtimeout (c, readtimeout, wait_for_timeout)
519
+ function check_readtimeout (c, readtimeout, wait_for_timeout, verbose )
520
520
while wait_for_timeout[]
521
521
if inactiveseconds (c) > readtimeout
522
- @warnv 2 " Connection Timeout: $c "
522
+ verbose >= 0 && @warn " Connection Timeout: $c "
523
523
try
524
524
writeheaders (c, Response (408 , [" Connection" => " close" ]))
525
525
finally
0 commit comments