aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/daemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r--src/microhttpd/daemon.c33
1 files 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,
436 { 436 {
437 MHD_socket_set_error_ (MHD_SCKT_EINTR_); 437 MHD_socket_set_error_ (MHD_SCKT_EINTR_);
438#ifdef EPOLL_SUPPORT 438#ifdef EPOLL_SUPPORT
439 connection->epoll_state &= ~MHD_EPOLL_STATE_READ_READY; 439 if (GNUTLS_E_AGAIN == res)
440 connection->epoll_state &= ~MHD_EPOLL_STATE_READ_READY;
440#endif 441#endif
441 return -1; 442 return -1;
442 } 443 }
@@ -480,7 +481,8 @@ send_tls_adapter (struct MHD_Connection *connection,
480 { 481 {
481 MHD_socket_set_error_ (MHD_SCKT_EINTR_); 482 MHD_socket_set_error_ (MHD_SCKT_EINTR_);
482#ifdef EPOLL_SUPPORT 483#ifdef EPOLL_SUPPORT
483 connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY; 484 if (GNUTLS_E_AGAIN == res)
485 connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY;
484#endif 486#endif
485 return -1; 487 return -1;
486 } 488 }
@@ -1068,11 +1070,8 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
1068 res = gnutls_record_recv (connection->tls_session, 1070 res = gnutls_record_recv (connection->tls_session,
1069 &urh->in_buffer[urh->in_buffer_used], 1071 &urh->in_buffer[urh->in_buffer_used],
1070 buf_size); 1072 buf_size);
1071 if ( (GNUTLS_E_AGAIN == res) || 1073 if (GNUTLS_E_AGAIN == res)
1072 (GNUTLS_E_INTERRUPTED == res) ) 1074 urh->app.celi &= ~MHD_EPOLL_STATE_READ_READY;
1073 {
1074 urh->app.celi &= ~MHD_EPOLL_STATE_READ_READY;
1075 }
1076 else if (res > 0) 1075 else if (res > 0)
1077 { 1076 {
1078 urh->in_buffer_used += res; 1077 urh->in_buffer_used += res;
@@ -1081,7 +1080,8 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
1081 connection->tls_read_ready = true; 1080 connection->tls_read_ready = true;
1082 } 1081 }
1083 } 1082 }
1084 else if (0 >= res) 1083 else if ( (0 >= res ) &&
1084 (GNUTLS_E_INTERRUPTED != res) )
1085 { 1085 {
1086 /* Connection was shut down or got unrecoverable error. 1086 /* Connection was shut down or got unrecoverable error.
1087 * signal by shrinking buffer so no more attempts will be 1087 * signal by shrinking buffer so no more attempts will be
@@ -1107,10 +1107,10 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
1107 { 1107 {
1108 int err = MHD_socket_get_error_ (); 1108 int err = MHD_socket_get_error_ ();
1109 1109
1110 if ( (MHD_SCKT_ERR_IS_EINTR_ (err)) || 1110 if (MHD_SCKT_ERR_IS_EAGAIN_ (err))
1111 (MHD_SCKT_ERR_IS_EAGAIN_ (err)) )
1112 urh->mhd.celi &= ~MHD_EPOLL_STATE_WRITE_READY; 1111 urh->mhd.celi &= ~MHD_EPOLL_STATE_WRITE_READY;
1113 else if (! MHD_SCKT_ERR_IS_LOW_RESOURCES_(err)) 1112 else if ( (! MHD_SCKT_ERR_IS_EINTR_ (err)) &&
1113 (! MHD_SCKT_ERR_IS_LOW_RESOURCES_(err)) )
1114 { 1114 {
1115 /* persistent / unrecoverable error, treat as 1115 /* persistent / unrecoverable error, treat as
1116 if connection was shut down. 1116 if connection was shut down.
@@ -1178,10 +1178,10 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
1178 else 1178 else
1179 { 1179 {
1180 const int err = MHD_socket_get_error_ (); 1180 const int err = MHD_socket_get_error_ ();
1181 if ( (MHD_SCKT_ERR_IS_EINTR_ (err)) || 1181 if (MHD_SCKT_ERR_IS_EAGAIN_ (err))
1182 (MHD_SCKT_ERR_IS_EAGAIN_ (err)) )
1183 urh->mhd.celi &= ~MHD_EPOLL_STATE_READ_READY; 1182 urh->mhd.celi &= ~MHD_EPOLL_STATE_READ_READY;
1184 else if (! MHD_SCKT_ERR_IS_LOW_RESOURCES_(err)) 1183 else if ( (! MHD_SCKT_ERR_IS_EINTR_ (err)) &&
1184 (! MHD_SCKT_ERR_IS_LOW_RESOURCES_(err)) )
1185 { 1185 {
1186 /* persistent / unrecoverable error, treat as 1186 /* persistent / unrecoverable error, treat as
1187 if connection was shut down */ 1187 if connection was shut down */
@@ -1216,8 +1216,7 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
1216 res = gnutls_record_send (connection->tls_session, 1216 res = gnutls_record_send (connection->tls_session,
1217 urh->out_buffer, 1217 urh->out_buffer,
1218 data_size); 1218 data_size);
1219 if ( (GNUTLS_E_AGAIN == res) || 1219 if (GNUTLS_E_AGAIN == res)
1220 (GNUTLS_E_INTERRUPTED == res) )
1221 { 1220 {
1222 urh->app.celi &= ~MHD_EPOLL_STATE_WRITE_READY; 1221 urh->app.celi &= ~MHD_EPOLL_STATE_WRITE_READY;
1223 } 1222 }
@@ -1235,7 +1234,7 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
1235 urh->out_buffer_used = 0; 1234 urh->out_buffer_used = 0;
1236 } 1235 }
1237 } 1236 }
1238 else 1237 else if (GNUTLS_E_INTERRUPTED != res)
1239 { 1238 {
1240 /* persistent / unrecoverable error, treat as 1239 /* persistent / unrecoverable error, treat as
1241 if connection was shut down. 1240 if connection was shut down.