Merge pull request #22 from craff/master

Unix.accept may raise an exception
This commit is contained in:
Simon Cruanes 2021-11-30 09:43:22 -05:00 committed by GitHub
commit ac05b9eaa1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1088,6 +1088,7 @@ let run (self:t) : (unit,_) result =
while self.running do
(* limit concurrency *)
Sem_.acquire 1 self.sem_max_connections;
try
let client_sock, _ = Unix.accept sock in
self.new_thread
(fun () ->
@ -1099,6 +1100,10 @@ let run (self:t) : (unit,_) result =
Sem_.release 1 self.sem_max_connections;
raise e
);
with e ->
_debug (fun k -> k
"Unix.accept or Thread.create raised an exception: %s"
(Printexc.to_string e))
done;
Ok ()
with e -> Error e