[Xfce4-commits] <xfce4-mailwatch-plugin:master> Fix recieving data from multiple packets

Ján Sučan noreply at xfce.org
Sat Aug 31 13:28:01 CEST 2013


Updating branch refs/heads/master
         to 19be3432dc694143084e33630a11a7d2157373d8 (commit)
       from d271a1a6e341fdc2e94762a747c4120bacdfe81a (commit)

commit 19be3432dc694143084e33630a11a7d2157373d8
Author: Ján Sučan <sucan at runbox.com>
Date:   Sat Aug 31 13:21:43 2013 +0200

    Fix recieving data from multiple packets
    
    Check if there are unread data in the gnutls buffers, first.
    
    gnutls is buffering data from the last packet internally. Therefore,
    there can be some received data, even if the socket file descriptor is
    not readable.
    
    Thanks to Bron Gondwana for tracing this bug.

 libmailwatch-core/mailwatch-net-conn.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libmailwatch-core/mailwatch-net-conn.c b/libmailwatch-core/mailwatch-net-conn.c
index 785eaf4..8d0d07d 100644
--- a/libmailwatch-core/mailwatch-net-conn.c
+++ b/libmailwatch-core/mailwatch-net-conn.c
@@ -760,6 +760,13 @@ xfce_mailwatch_net_conn_recv_internal(XfceMailwatchNetConn *net_conn,
         if(!block)
             tv.tv_sec = 0;
 
+#ifdef HAVE_SSL_SUPPORT
+        /* Read data from the gnutls read buffer, first. */
+        if (net_conn->is_secure
+            && (ret = gnutls_record_check_pending(net_conn->gt_session)) > 0) {
+            break;
+        }
+#endif
         ret = select(FD_SETSIZE, &rfd, NULL, NULL, &tv);
         if(ret > 0 && FD_ISSET(net_conn->fd, &rfd))
             break;


More information about the Xfce4-commits mailing list