# Servers.jl
function listenloop(f, listener, conns, tcpisvalid,
max_connections, readtimeout, access_log, ready_to_accept, verbose)
sem = Base.Semaphore(max_connections)
...
while isopen(listener)
try
Base.acquire(sem)
io = accept(listener)
if io === nothing
@warnv 1 "unable to accept new connection"
continue
elseif !tcpisvalid(io)
@warnv 1 "!tcpisvalid: $io"
close(io)
continue
end
conn = Connection(io)
...
There is no Base.release(sem) before continue in the case when something wrong happens when calling accept. As a result, after each continue, semaphore max value decreases.
There is no
Base.release(sem)
beforecontinue
in the case when something wrong happens when callingaccept
. As a result, after eachcontinue
, semaphore max value decreases.