diff options
-rw-r--r-- | src/example.ml | 2 | ||||
-rw-r--r-- | src/poolclient.ml | 13 | ||||
-rw-r--r-- | src/util.ml | 5 |
3 files changed, 13 insertions, 7 deletions
diff --git a/src/example.ml b/src/example.ml index 7b6f23e..2aade1f 100644 --- a/src/example.ml +++ b/src/example.ml @@ -76,7 +76,7 @@ module Example (K : Kahn.S) = struct let main2 : int K.process = (delay K.new_channel()) >>= (fun (qi, qo) -> - (fib_rec 50 7 qo) >>= + (fib_rec 53 7 qo) >>= (fun () -> K.get qi)) end diff --git a/src/poolclient.ml b/src/poolclient.ml index 00b0d35..b6d5a89 100644 --- a/src/poolclient.ml +++ b/src/poolclient.ml @@ -10,11 +10,14 @@ let fullfill_request task (addr, port) n = for i = 0 to n-1 do Format.eprintf "Spawn %s@." task; if fork() = 0 then begin - let sock = socket PF_INET SOCK_STREAM 0 in - connect sock (make_addr addr port); - dup2 sock stdin; - dup2 sock stdout; - execv task [|task|] + try + let sock = socket PF_INET SOCK_STREAM 0 in + connect sock (make_addr addr port); + dup2 sock stdin; + dup2 sock stdout; + execv task [|task|] + with + | _ -> exit 0 end done diff --git a/src/util.ml b/src/util.ml index 5155fd7..b37ae4f 100644 --- a/src/util.ml +++ b/src/util.ml @@ -18,5 +18,8 @@ let read_one_msg fd = assert (read fd hdr 0 Marshal.header_size = Marshal.header_size); let dlen = Marshal.data_size hdr 0 in let data = String.create dlen in - assert (read fd data 0 dlen = dlen); + let rl = ref 0 in + while !rl < dlen do + rl := !rl + read fd data !rl (dlen - !rl) + done; Marshal.from_string (hdr ^ data) 0 |