From 58096449c6044b7aade5cd41cfd71c6bec1d273d Mon Sep 17 00:00:00 2001
From: Diego Nehab
-client:receive([pattern1, pattern2,
-... patternN])
+client:receive([pattern])
Reads data from a client object, according to the specified read
-patterns. Patterns follow the Lua file I/O format, and the difference in performance between all patterns is negligible.
+pattern. Patterns follow the Lua file I/O format, and the difference in performance between all patterns is negligible.
-The parameters pattern1, pattern2, ...
-patternN can be any of the following:
+Pattern can be any of the following:
-The method returns one value for each pattern, followed by a single
-error code that can be nil in case of success, the string
-'closed' in case the connection was closed before the
-transmission was completed or the string 'timeout' in case
-there was a timeout during the operation.
+If successful, the method returns the received pattern. In case of error,
+the method returns nil followed by an error message which
+can be the string 'closed' in case the connection was
+closed before the transmission was completed or the string
+'timeout' in case there was a timeout during the operation.
+Also, after the error message, the function returns the partial result of
+the transmission.
-Note: In case of error, the method always return everything it managed
-to download before the error condition was met.
+Important note: This function was changed severely. It used
+to support multiple patterns (but I have never seen this feature used) and
+partial results used to be returned in the same way as successful results.
+This last feature violated the idea that all functions should return
+nil on error. Thus the change.
@@ -267,16 +265,21 @@ of bytes from the socket.
-Shuts down part of a full duplex connection. +Shuts down part of a full-duplex connection.
-- cgit v1.2.3-55-g6feb