mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-05 19:00:32 -05:00
moved back acquire before accept but inside the try ... with ... one never knowns
This commit is contained in:
parent
97eeaf96dc
commit
c3265af08f
1 changed files with 3 additions and 2 deletions
|
|
@ -724,7 +724,8 @@ module Sem_ = struct
|
|||
Condition.broadcast t.cond;
|
||||
Mutex.unlock t.mutex
|
||||
|
||||
let available_connections t = t.n
|
||||
(* +1 because we decrease the semaphore before Unix.accept *)
|
||||
let available_connections t = t.n + 1
|
||||
|
||||
end
|
||||
|
||||
|
|
@ -1123,8 +1124,8 @@ let run (self:t) : (unit,_) result =
|
|||
while self.running do
|
||||
(* limit concurrency *)
|
||||
try
|
||||
let client_sock, _ = Unix.accept sock in
|
||||
Sem_.acquire 1 self.sem_max_connections;
|
||||
let client_sock, _ = Unix.accept sock in
|
||||
self.new_thread
|
||||
(fun () ->
|
||||
try
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue