summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2012-02-21 20:09:01 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2012-02-21 20:09:01 +0100
commit624c7af212b211d856b05223fa20a66388c92890 (patch)
treecc52d0c4f2bab6b5a366f223b83b679a96378c58
parent7583746247b71a017edede4f6046830d20602a4d (diff)
downloadgnutls-624c7af212b211d856b05223fa20a66388c92890.tar.gz
updated documentation
-rw-r--r--lib/system.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/system.c b/lib/system.c
index a2a9091b98..1573bb356e 100644
--- a/lib/system.c
+++ b/lib/system.c
@@ -112,29 +112,29 @@ system_read (gnutls_transport_ptr_t ptr, void *data, size_t data_size)
}
/* Wait for data to be received within a timeout period in milliseconds.
- * If data_size > 0 it will return the specified amount of data in
- * peek mode.
+ * To catch a termination it will also try to receive 0 bytes from the
+ * socket if select reports to proceed.
*
- * Returns -1 on error, 0 on timeout.
+ * Returns -1 on error, 0 on timeout, positive value if data are available for reading.
*/
int system_recv_timeout(gnutls_transport_ptr_t ptr, unsigned int ms)
{
fd_set rfds;
struct timeval tv;
int ret, ret2;
+int fd = GNUTLS_POINTER_TO_INT(ptr);
FD_ZERO(&rfds);
- FD_SET(GNUTLS_POINTER_TO_INT(ptr), &rfds);
+ FD_SET(fd, &rfds);
tv.tv_sec = 0;
tv.tv_usec = ms * 1000;
- ret = select(GNUTLS_POINTER_TO_INT(ptr)+1, &rfds, NULL, NULL, &tv);
+ ret = select(fd+1, &rfds, NULL, NULL, &tv);
if (ret <= 0)
return ret;
-
- ret2 = recv(GNUTLS_POINTER_TO_INT(ptr), NULL, 0, MSG_PEEK);
+ ret2 = recv(fd, NULL, 0, MSG_PEEK);
if (ret2 == -1)
return ret2;