[Unison-hackers] [unison-svn] r496 - trunk/src

vouillon at seas.upenn.edu vouillon at seas.upenn.edu
Mon May 21 06:06:36 EDT 2012


Author: vouillon
Date: 2012-05-21 06:06:36 -0400 (Mon, 21 May 2012)
New Revision: 496

Modified:
   trunk/src/RECENTNEWS
   trunk/src/mkProjectInfo.ml
   trunk/src/transfer.ml
Log:
* Fix bug in last commit


Modified: trunk/src/RECENTNEWS
===================================================================
--- trunk/src/RECENTNEWS	2012-04-30 16:18:35 UTC (rev 495)
+++ trunk/src/RECENTNEWS	2012-05-21 10:06:36 UTC (rev 496)
@@ -1,3 +1,8 @@
+CHANGES FROM VERSION 2.45.8
+
+* Fix bug in last commit
+
+-------------------------------
 CHANGES FROM VERSION 2.45.7
 
 * Added some debugging code in transfer.ml

Modified: trunk/src/mkProjectInfo.ml
===================================================================
--- trunk/src/mkProjectInfo.ml	2012-04-30 16:18:35 UTC (rev 495)
+++ trunk/src/mkProjectInfo.ml	2012-05-21 10:06:36 UTC (rev 496)
@@ -70,3 +70,4 @@
 
 
 
+

Modified: trunk/src/transfer.ml
===================================================================
--- trunk/src/transfer.ml	2012-04-30 16:18:35 UTC (rev 495)
+++ trunk/src/transfer.ml	2012-05-21 10:06:36 UTC (rev 496)
@@ -264,15 +264,20 @@
   let buf = String.create bufSz in
   let q = makeQueue 0 in
   let rec sendSlice length =
-    let count =
-      reallyRead infd buf 0
-        (if length > bufSzFS then bufSz else Uutil.Filesize.toInt length) in
-    queueToken q showProgress transmit (STRING (buf, 0, count)) >>= (fun () ->
-    let length = Uutil.Filesize.sub length (Uutil.Filesize.ofInt count) in
-    if count = bufSz && length > Uutil.Filesize.zero then
-      sendSlice length
-    else
-      return ())
+    if length > Uutil.Filesize.zero then begin
+      let count =
+        reallyRead infd buf 0
+          (if length > bufSzFS then bufSz else Uutil.Filesize.toInt length) in
+      if count = 0 then
+        Lwt.return ()
+      else begin
+        queueToken q showProgress transmit (STRING (buf, 0, count))
+          >>= fun () ->
+        let length = Uutil.Filesize.sub length (Uutil.Filesize.ofInt count) in
+        sendSlice length
+      end
+    end else
+      Lwt.return ()
   in
   sendSlice length >>= (fun () ->
   queueToken q showProgress transmit EOF >>= (fun () ->



More information about the Unison-hackers mailing list