diff options
| author | Mishio595 <[email protected]> | 2018-11-30 07:41:33 -0700 |
|---|---|---|
| committer | Mishio595 <[email protected]> | 2018-11-30 07:41:33 -0700 |
| commit | 38a968c585f87736397fd5b576c51f7dbe5d393a (patch) | |
| tree | 05b361e7844645ee8cd2bf5ef811ce8e48f2e4a7 | |
| parent | Fix all the errors from coding without merlin (diff) | |
| download | disml-38a968c585f87736397fd5b576c51f7dbe5d393a.tar.xz disml-38a968c585f87736397fd5b576c51f7dbe5d393a.zip | |
some improvements
| -rw-r--r-- | lib/sharder.ml | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/sharder.ml b/lib/sharder.ml index 7b14884..8e8c1f9 100644 --- a/lib/sharder.ml +++ b/lib/sharder.ml @@ -183,7 +183,7 @@ module Make(H: S.Http) = struct print_endline @@ "Invalid Opcode: " ^ Opcode.to_string opcode; return shard - let rec create ~url ~shards () = + let create ~url ~shards () = let open Core in let uri = (url ^ "?v=6&encoding=json") |> Uri.of_string in let extra_headers = H.Base.process_request_headers () in @@ -233,7 +233,8 @@ module Make(H: S.Http) = struct `TCP (h, p) in Conduit_async.V2.connect addr >>= tcp_fun - and recreate shard = + + let recreate shard = print_endline "Reconnecting..."; (match shard.hb with | Some hb -> Ivar.fill_if_empty hb () @@ -259,14 +260,14 @@ module Make(H: S.Http) = struct let (read, _) = t.state.pipe in Pipe.read read >>= fun frame -> - let _ = match Shard.parse frame with + (match Shard.parse frame with | Some f -> begin Shard.handle_frame ~f t.state >>> fun shard -> t.state <- shard; end | None -> Shard.recreate t.state >>> fun s -> t.state <- s; - in + ); return t >>= fun t -> List.iter ~f:(fun f -> f t.state) t.binds; |