[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libmicrohttpd] 02/02: Fixed: EINTERRUPTED and GNUTLS_E_INT
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libmicrohttpd] 02/02: Fixed: EINTERRUPTED and GNUTLS_E_INTERRUPTED must not clear read/write ready flag |
Date: |
Sun, 26 Feb 2017 22:25:36 +0100 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit d686cb083345e50e5ce1f5de14fad756fe827a59
Author: Evgeny Grin (Karlson2k) <address@hidden>
AuthorDate: Mon Feb 27 00:24:14 2017 +0300
Fixed: EINTERRUPTED and GNUTLS_E_INTERRUPTED must not clear read/write
ready flag
---
src/microhttpd/daemon.c | 33 ++++++++++++++++-----------------
1 file changed, 16 insertions(+), 17 deletions(-)
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 6a3c0ff5..00ad2ed6 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -436,7 +436,8 @@ recv_tls_adapter (struct MHD_Connection *connection,
{
MHD_socket_set_error_ (MHD_SCKT_EINTR_);
#ifdef EPOLL_SUPPORT
- connection->epoll_state &= ~MHD_EPOLL_STATE_READ_READY;
+ if (GNUTLS_E_AGAIN == res)
+ connection->epoll_state &= ~MHD_EPOLL_STATE_READ_READY;
#endif
return -1;
}
@@ -480,7 +481,8 @@ send_tls_adapter (struct MHD_Connection *connection,
{
MHD_socket_set_error_ (MHD_SCKT_EINTR_);
#ifdef EPOLL_SUPPORT
- connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY;
+ if (GNUTLS_E_AGAIN == res)
+ connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY;
#endif
return -1;
}
@@ -1068,11 +1070,8 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
res = gnutls_record_recv (connection->tls_session,
&urh->in_buffer[urh->in_buffer_used],
buf_size);
- if ( (GNUTLS_E_AGAIN == res) ||
- (GNUTLS_E_INTERRUPTED == res) )
- {
- urh->app.celi &= ~MHD_EPOLL_STATE_READ_READY;
- }
+ if (GNUTLS_E_AGAIN == res)
+ urh->app.celi &= ~MHD_EPOLL_STATE_READ_READY;
else if (res > 0)
{
urh->in_buffer_used += res;
@@ -1081,7 +1080,8 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
connection->tls_read_ready = true;
}
}
- else if (0 >= res)
+ else if ( (0 >= res ) &&
+ (GNUTLS_E_INTERRUPTED != res) )
{
/* Connection was shut down or got unrecoverable error.
* signal by shrinking buffer so no more attempts will be
@@ -1107,10 +1107,10 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
{
int err = MHD_socket_get_error_ ();
- if ( (MHD_SCKT_ERR_IS_EINTR_ (err)) ||
- (MHD_SCKT_ERR_IS_EAGAIN_ (err)) )
+ if (MHD_SCKT_ERR_IS_EAGAIN_ (err))
urh->mhd.celi &= ~MHD_EPOLL_STATE_WRITE_READY;
- else if (! MHD_SCKT_ERR_IS_LOW_RESOURCES_(err))
+ else if ( (! MHD_SCKT_ERR_IS_EINTR_ (err)) &&
+ (! MHD_SCKT_ERR_IS_LOW_RESOURCES_(err)) )
{
/* persistent / unrecoverable error, treat as
if connection was shut down.
@@ -1178,10 +1178,10 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
else
{
const int err = MHD_socket_get_error_ ();
- if ( (MHD_SCKT_ERR_IS_EINTR_ (err)) ||
- (MHD_SCKT_ERR_IS_EAGAIN_ (err)) )
+ if (MHD_SCKT_ERR_IS_EAGAIN_ (err))
urh->mhd.celi &= ~MHD_EPOLL_STATE_READ_READY;
- else if (! MHD_SCKT_ERR_IS_LOW_RESOURCES_(err))
+ else if ( (! MHD_SCKT_ERR_IS_EINTR_ (err)) &&
+ (! MHD_SCKT_ERR_IS_LOW_RESOURCES_(err)) )
{
/* persistent / unrecoverable error, treat as
if connection was shut down */
@@ -1216,8 +1216,7 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
res = gnutls_record_send (connection->tls_session,
urh->out_buffer,
data_size);
- if ( (GNUTLS_E_AGAIN == res) ||
- (GNUTLS_E_INTERRUPTED == res) )
+ if (GNUTLS_E_AGAIN == res)
{
urh->app.celi &= ~MHD_EPOLL_STATE_WRITE_READY;
}
@@ -1235,7 +1234,7 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
urh->out_buffer_used = 0;
}
}
- else
+ else if (GNUTLS_E_INTERRUPTED != res)
{
/* persistent / unrecoverable error, treat as
if connection was shut down.
--
To stop receiving notification emails like this one, please contact
address@hidden