[MLton-commit] r6937

Vesa Karvonen vesak at mlton.org
Tue Oct 14 10:45:04 PDT 2008


Check that there is no garbage in packets.

----------------------------------------------------------------------

U   mltonlib/trunk/org/mlton/vesak/rpc-lib/unstable/detail/protocol.sml

----------------------------------------------------------------------

Modified: mltonlib/trunk/org/mlton/vesak/rpc-lib/unstable/detail/protocol.sml
===================================================================
--- mltonlib/trunk/org/mlton/vesak/rpc-lib/unstable/detail/protocol.sml	2008-10-14 17:14:57 UTC (rev 6936)
+++ mltonlib/trunk/org/mlton/vesak/rpc-lib/unstable/detail/protocol.sml	2008-10-14 17:45:02 UTC (rev 6937)
@@ -62,13 +62,14 @@
               (#1 (Word8ArraySlice.base data), 0)))))
 
    fun recv t =
-       case #1 o Generic.unpickler
-                  t
-                  (IOSMonad.fromReader Word8ArraySlice.getItem)
+       case Generic.unpickler t (IOSMonad.fromReader Word8ArraySlice.getItem)
         of unpickle =>
            recv1 >>= (fn data =>
            try (fn () => unpickle data,
-                return,
+                fn (v, s) =>
+                   if Word8ArraySlice.isEmpty s
+                   then return v
+                   else error (Fail "garbage in packet"),
                 error))
 
    val skip = recv1 >>= (fn _ => return ())




More information about the MLton-commit mailing list