gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [libmicrohttpd] 02/02: thread_main_connection_upgrade(): pr


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] 02/02: thread_main_connection_upgrade(): process data from TLS buffers
Date: Sun, 08 Jan 2017 21:48:08 +0100

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 295a4884c7fb4c769c73e8013bd6e47803927703
Author: Evgeny Grin (Karlson2k) <address@hidden>
AuthorDate: Sun Jan 8 23:38:56 2017 +0300

    thread_main_connection_upgrade(): process data from TLS buffers
---
 src/microhttpd/daemon.c | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 1e94f218..a6edd787 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -1289,11 +1289,23 @@ thread_main_connection_upgrade (struct MHD_Connection 
*con)
               break;
             }
           if (MHD_INVALID_SOCKET != max_fd)
-            num_ready = MHD_SYS_select_ (max_fd + 1,
-                                         &rs,
-                                         &ws,
-                                         NULL,
-                                         NULL);
+            {
+              struct timeval* tvp;
+              struct timeval tv;
+              if (con->tls_read_ready)
+                { /* No need to wait if incoming data is already pending in 
TLS buffers. */
+                  tv.tv_sec = 0;
+                  tv.tv_usec = 0;
+                  tvp = &tv;
+                }
+              else
+                tvp = NULL;
+              num_ready = MHD_SYS_select_ (max_fd + 1,
+                                           &rs,
+                                           &ws,
+                                           NULL,
+                                           tvp);
+            }
           else
             num_ready = 0;
           if (num_ready < 0)
@@ -1325,12 +1337,12 @@ thread_main_connection_upgrade (struct MHD_Connection 
*con)
   else if (0 != (daemon->options & MHD_USE_TLS))
     {
       /* use poll() */
-      const unsigned int timeout = UINT_MAX;
 
       while ( (MHD_CONNECTION_UPGRADE == con->state) ||
               (0 != urh->out_buffer_used) )
         {
           struct pollfd p[2];
+          unsigned int timeout;
 
           memset (p,
                   0,
@@ -1346,6 +1358,11 @@ thread_main_connection_upgrade (struct MHD_Connection 
*con)
           if (0 != urh->in_buffer_used)
             p[1].events |= POLLOUT;
 
+          if (con->tls_read_ready)
+            timeout = 0; /* No need to wait if incoming data is already 
pending in TLS buffers. */
+          else
+            timeout = UINT_MAX;
+
           if ( (0 != (p[0].events | p[1].events)) &&
                (MHD_sys_poll_ (p,
                                2,

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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