gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [libmicrohttpd] 02/03: *_param_adapter: Distinguish between


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] 02/03: *_param_adapter: Distinguish between network error and remote hard close
Date: Sun, 27 Aug 2017 20:56:26 +0200

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 1d3131799b6783bce885a9290afa23996103a4f2
Author: Evgeny Grin (Karlson2k) <address@hidden>
AuthorDate: Sun Aug 20 18:43:17 2017 +0300

    *_param_adapter: Distinguish between network error and remote hard close
---
 src/microhttpd/connection.c       | 8 ++++++--
 src/microhttpd/connection.h       | 5 +++--
 src/microhttpd/connection_https.c | 4 ++--
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 95823992..8fadc8d8 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -152,8 +152,10 @@ recv_param_adapter (struct MHD_Connection *connection,
         }
       if (MHD_SCKT_ERR_IS_EINTR_ (err))
         return MHD_ERR_AGAIN_;
+      if (MHD_SCKT_ERR_IS_ (err, MHD_SCKT_ECONNRESET_))
+        return MHD_ERR_CONNRESET_;
       /* Treat any other error as hard error. */
-      return MHD_ERR_CONNRESET_;
+      return MHD_ERR_NOTCONN_;
     }
 #ifdef EPOLL_SUPPORT
   else if (i > (size_t)ret)
@@ -204,8 +206,10 @@ send_param_adapter (struct MHD_Connection *connection,
         }
       if (MHD_SCKT_ERR_IS_EINTR_ (err))
         return MHD_ERR_AGAIN_;
+      if (MHD_SCKT_ERR_IS_ (err, MHD_SCKT_ECONNRESET_))
+        return MHD_ERR_CONNRESET_;
       /* Treat any other error as hard error. */
-      return MHD_ERR_CONNRESET_;
+      return MHD_ERR_NOTCONN_;
     }
 #ifdef EPOLL_SUPPORT
   else if (i > (size_t)ret)
diff --git a/src/microhttpd/connection.h b/src/microhttpd/connection.h
index f5316887..37e4d550 100644
--- a/src/microhttpd/connection.h
+++ b/src/microhttpd/connection.h
@@ -36,12 +36,13 @@
 #define MHD_ERR_AGAIN_ (-3073)
 
 /**
- * "Connection (remote) reset" error code
+ * Connection was hard-closed by remote peer.
  */
 #define MHD_ERR_CONNRESET_ (-3074)
 
 /**
- * "Not connected" error code
+ * Connection is not connected anymore due to
+ * network error or any other reason.
  */
 #define MHD_ERR_NOTCONN_ (-3075)
 
diff --git a/src/microhttpd/connection_https.c 
b/src/microhttpd/connection_https.c
index 73589b2c..03f80b8c 100644
--- a/src/microhttpd/connection_https.c
+++ b/src/microhttpd/connection_https.c
@@ -73,7 +73,7 @@ recv_tls_adapter (struct MHD_Connection *connection,
       /* Likely 'GNUTLS_E_INVALID_SESSION' (client communication
          disrupted); interpret as a hard error */
       connection->tls_read_ready = false;
-      return MHD_ERR_CONNRESET_;
+      return MHD_ERR_NOTCONN_;
     }
 
 #ifdef EPOLL_SUPPORT
@@ -125,7 +125,7 @@ send_tls_adapter (struct MHD_Connection *connection,
     {
       /* Likely 'GNUTLS_E_INVALID_SESSION' (client communication
          disrupted); interpret as a hard error */
-      return MHD_ERR_CONNRESET_;
+      return MHD_ERR_NOTCONN_;
     }
 #ifdef EPOLL_SUPPORT
   /* If NOT all available data was sent - socket is not write ready anymore. */

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



reply via email to

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