1. Dmitry Grebeniuk
  2. amall

Commits

Dmitry Grebeniuk  committed b66b430

testing new ocaml_monad_io functionality; testing EMFILE on accept

  • Participants
  • Parent commits 4c8f57f
  • Branches default

Comments (0)

Files changed (2)

File src/amall_http_service.ml

View file
  • Ignore whitespace
     ;
 
     value listener_run l =
+      let open I.Ops in
       let io_srv = io_listener_run l in
-      match IO.runIO (IO.wait_server io_srv) with
+      let () = dbg "S.lr 1" in
+      match IO.runIO
+        (IO.wait_server io_srv >>% fun () ->
+         let () = dbg "S.lr 2" in
+         IO.return ()
+        ) with
       [ `Ok () -> ()
       | `Error e -> raise e
       ]

File tests/test_http_service.ml

View file
  • Ignore whitespace
 
 open Printf;
 
+value rec open_files n =
+  if (try (ignore (open_in_bin "README"); True) with [ Sys_error _ -> False ])
+  then open_files (n + 1)
+  else n
+;
+
 value my_func segpath rq =
+  (* let _files = open_files 0 in *)
   let txt = sprintf "path: [%s]\nparams string: %s\nparams parsed: %s\n"
     (String.concat " ; " &
      List.map (sprintf "%S") &
            )
      ]
     )
+    (* _files *)
   in
   I.return
   { rs_status_code = 200
 value () = (dbg "pre"; S.mount_http my_endpoint my_func; dbg "post")
 ;
 
-value () = S.listener_run my_listener
+value () =
+  try S.listener_run my_listener
+  with [ e -> failwith "listener_run exn: %s" (Printexc.to_string e) ]
 ;