From 0f6c6a587b9a38ec0cef312cd9d79cbe34018b88 Mon Sep 17 00:00:00 2001 From: Hannes Mehnert Date: Tue, 31 Dec 2019 20:31:45 +0100 Subject: [PATCH] listen: do not catch out of memory exception --- src/netif.ml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/netif.ml b/src/netif.ml index 6eb414e..1c99ea9 100644 --- a/src/netif.ml +++ b/src/netif.ml @@ -106,11 +106,12 @@ let rec read t buf = let safe_apply f x = Lwt.catch (fun () -> f x) - (fun exn -> - Log.err (fun m -> m "[listen] error while handling %s, continuing. bt: %s" - (Printexc.to_string exn) (Printexc.get_backtrace ())); - Lwt.return_unit) - + (function + | Out_of_memory -> Lwt.fail Out_of_memory + | exn -> + Log.err (fun m -> m "[listen] error while handling %s, continuing. bt: %s" + (Printexc.to_string exn) (Printexc.get_backtrace ())); + Lwt.return_unit) (* Loop and listen for packets permanently *) (* this function has to be tail recursive, since it is called at the