gnutls-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU gnutls branch, master, updated. gnutls_2_11_6-320-gc81ea58


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU gnutls branch, master, updated. gnutls_2_11_6-320-gc81ea58
Date: Fri, 18 Mar 2011 19:55:07 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU gnutls".

http://git.savannah.gnu.org/cgit/gnutls.git/commit/?id=c81ea586b765639860ae9d075661d7541a642e7c

The branch, master has been updated
       via  c81ea586b765639860ae9d075661d7541a642e7c (commit)
       via  0ee91c39a7ced6260cdd5c0d85c45a22a19d67d5 (commit)
      from  e27c6954f248051a8808c568119f4d164921bdc3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c81ea586b765639860ae9d075661d7541a642e7c
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Fri Mar 18 20:55:02 2011 +0100

    Check for rejected connections in system_recv_timeout().

commit 0ee91c39a7ced6260cdd5c0d85c45a22a19d67d5
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Fri Mar 18 20:46:19 2011 +0100

    quickly discuss callback format.

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

Summary of changes:
 lib/gnutls_buffers.c  |    2 +-
 lib/system.c          |   17 ++++++++++++++---
 lib/system_override.c |    4 ++++
 3 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/lib/gnutls_buffers.c b/lib/gnutls_buffers.c
index cbb0546..31e56b5 100644
--- a/lib/gnutls_buffers.c
+++ b/lib/gnutls_buffers.c
@@ -603,7 +603,7 @@ int
 _gnutls_io_check_recv (gnutls_session_t session, void* data, size_t data_size, 
unsigned int ms)
 {
   gnutls_transport_ptr_t fd = session->internals.transport_send_ptr;
-  int ret;
+  int ret = 0;
   
   if (session->internals.pull_timeout_func == system_recv_timeout && 
     session->internals.pull_func != system_read)
diff --git a/lib/system.c b/lib/system.c
index 0aa569f..dd2d74f 100644
--- a/lib/system.c
+++ b/lib/system.c
@@ -108,12 +108,14 @@ system_read_peek (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.
+ *
+ * Returns -1 on error, 0 on timeout.
  */
 int system_recv_timeout(gnutls_transport_ptr_t ptr, void* data, size_t 
data_size, unsigned int ms)
 {
 fd_set rfds;
 struct timeval tv;
-int ret;
+int ret, ret2;
 
   FD_ZERO(&rfds);
   FD_SET(GNUTLS_POINTER_TO_INT(ptr), &rfds);
@@ -122,10 +124,19 @@ int ret;
   tv.tv_usec = ms * 1000;
   
   ret = select(GNUTLS_POINTER_TO_INT(ptr)+1, &rfds, NULL, NULL, &tv);
-
-  if (ret <= 0 || data_size == 0)
+  if (ret <= 0)
     return ret;
 
+  
+  if (data_size == 0)
+    {
+      ret2 = recv(GNUTLS_POINTER_TO_INT(ptr), NULL, 0, MSG_PEEK);
+      if (ret2 == -1)
+        return ret2;
+      
+      return ret;
+    }
+
   /* only report ok if the next message is from the peer we expect
    * from 
    */
diff --git a/lib/system_override.c b/lib/system_override.c
index b529a5f..3822189 100644
--- a/lib/system_override.c
+++ b/lib/system_override.c
@@ -99,6 +99,8 @@ gnutls_transport_set_global_errno (int err)
  * This is the function where you set a function for gnutls to receive
  * data.  Normally, if you use berkeley style sockets, do not need to
  * use this function since the default (recv(2)) will probably be ok.
+ * The callback should return 0 on connection termination, a positive
+ * number indicating the number of bytes received, and -1 on error.
  *
  * gnutls_pull_func is of the form,
  * ssize_t (*gnutls_pull_func)(gnutls_transport_ptr_t, void*, size_t);
@@ -146,6 +148,8 @@ gnutls_transport_set_pull_timeout_function 
(gnutls_session_t session,
  * sockets, you do not need to use this function since the default
  * (send(2)) will probably be ok.  Otherwise you should specify this
  * function for gnutls to be able to send data.
+ * The callback should return a positive number indicating the
+ * bytes sent, and -1 on error.
  *
  * push_func is of the form,
  * ssize_t (*gnutls_push_func)(gnutls_transport_ptr_t, const void*, size_t);


hooks/post-receive
-- 
GNU gnutls



reply via email to

[Prev in Thread] Current Thread [Next in Thread]