Advertisement
Guest User

Untitled

a guest
Jan 12th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. let echo ic oc =
  2. let char_stream = ref None in
  3. let t = Lwt_timeout.create 10 begin fun () ->
  4. (match !char_stream with
  5. | None -> log_info_bad "this is bad"
  6. | Some c ->
  7. Lwt_io.write_chars oc c)
  8. |> Lwt.ignore_result
  9. end
  10. in
  11. Lwt_timeout.start t;
  12. Lwt.return (char_stream := Some (Lwt_io.read_chars ic))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement