From 440da6959f36022185fc465590b53bd10acda862 Mon Sep 17 00:00:00 2001 From: Petteri Aimonen Date: Fri, 24 Aug 2012 21:32:42 +0300 Subject: [PATCH] Add note that stream callbacks must read the whole requested length. Fixes issue #22. --- docs/concepts.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/concepts.rst b/docs/concepts.rst index 122d29c..d326114 100644 --- a/docs/concepts.rst +++ b/docs/concepts.rst @@ -50,6 +50,7 @@ There are a few generic rules for callback functions: #) Use state to store your own data, such as a file descriptor. #) *bytes_written* and *bytes_left* are updated by pb_write and pb_read. #) Your callback may be used with substreams. In this case *bytes_left*, *bytes_written* and *max_size* have smaller values than the original stream. Don't use these values to calculate pointers. +#) Always read or write the full requested length of data. For example, POSIX *recv()* needs the *MSG_WAITALL* parameter to accomplish this. Output streams -------------- -- 2.16.6