diff --git a/flake.lock b/flake.lock index f08386f..57ed3a2 100644 --- a/flake.lock +++ b/flake.lock @@ -41,11 +41,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1716844469, - "narHash": "sha256-2Edbn0TOoBC7+AY0rQeoYPFRWK89lVVgrGZxwxYX9rU=", + "lastModified": 1722151528, + "narHash": "sha256-NDM7hK1MIhZnhaltiXMvGaiU5XumYWPBNrp6q1bKbbg=", "owner": "nix-ocaml", "repo": "nix-overlays", - "rev": "cd34c0a555802e83b38196719c094c335a6c4f81", + "rev": "7bf7f83302ca7a628abff99a58a49d22bb1855e2", "type": "github" }, "original": { @@ -56,17 +56,17 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1716792620, - "narHash": "sha256-wQmXzee/veETYJv93TkRYsAQkEdt2QYCJeJil5SrJfg=", + "lastModified": 1722108208, + "narHash": "sha256-dJn6yHAR2dBfQ3qwqK0CJY1SY8z569PeqAJrXKusfVU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "7d7cf1590c05d799745bf456f2b95b798f48d3bb", + "rev": "0ad7ed487c49eaee43c557133c6e37612d59a632", "type": "github" }, "original": { "owner": "NixOS", "repo": "nixpkgs", - "rev": "7d7cf1590c05d799745bf456f2b95b798f48d3bb", + "rev": "0ad7ed487c49eaee43c557133c6e37612d59a632", "type": "github" } }, diff --git a/lwt/gluten_lwt.ml b/lwt/gluten_lwt.ml index c975843..f3ed1c3 100644 --- a/lwt/gluten_lwt.ml +++ b/lwt/gluten_lwt.ml @@ -47,13 +47,14 @@ module IO_loop = struct (fun n -> Lwt.wakeup_later u n); p - let start : type t fd. - (module IO with type socket = fd) - -> (module Gluten.RUNTIME with type t = t) - -> t - -> read_buffer_size:int - -> fd - -> unit Lwt.t + let start : + type t fd. + (module IO with type socket = fd) + -> (module Gluten.RUNTIME with type t = t) + -> t + -> read_buffer_size:int + -> fd + -> unit Lwt.t = fun (module Io) (module Runtime) t ~read_buffer_size socket -> let read_buffer = Buffer.create read_buffer_size in @@ -64,9 +65,9 @@ module IO_loop = struct | `Read -> Lwt.catch (fun () -> - read (module Io) socket read_buffer >>= fun (_ : int) -> + read (module Io) socket read_buffer >|= fun (_ : int) -> let (_ : int) = Buffer.get read_buffer ~f:(Runtime.read t) in - Lwt.return_unit) + ()) (function | End_of_file -> let (_ : int) = @@ -122,11 +123,11 @@ module Server (Io : IO) = struct type addr = Io.addr let create_connection_handler - ~read_buffer_size - ~protocol - connection - _client_addr - socket + ~read_buffer_size + ~protocol + connection + _client_addr + socket = let connection = Server.create ~protocol connection in IO_loop.start @@ -137,12 +138,12 @@ module Server (Io : IO) = struct socket let create_upgradable_connection_handler - ~read_buffer_size - ~protocol - ~create_protocol - ~request_handler - client_addr - socket + ~read_buffer_size + ~protocol + ~create_protocol + ~request_handler + client_addr + socket = let connection = Server.create_upgradable