Commits

Anonymous committed 67504bb Draft

failing early when 'get_piece_it' fails

Comments (0)

Files changed (2)

     value take : int -> enumeratee 'el 'el 'a
     ;
 
+    value take_or_fail : int -> enumeratee 'el 'el 'a
+    ;
+
     value stream2list : iteratee 'el (list 'el)
     ;
 

dumbstreaming_it.ml

         | ([len :: lens], I.IE_cont None k) ->
             let this_piece_it : I.iteratee char 'i = get_piece_it
               ~totalsize ~piecenumber ~piecesize:len ~totalcount in
-            (I.joinI & I.take len this_piece_it) >>= fun this_piece_res ->
+            (I.joinI &
+               I.take_or_fail len this_piece_it) >>= fun this_piece_res ->
             read_eol >>= fun () ->
 
             I.lift (I.feedI k (I.chunk_of this_piece_res))