gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r5601 - libmicrohttpd/src/daemon


From: gnunet
Subject: [GNUnet-SVN] r5601 - libmicrohttpd/src/daemon
Date: Sat, 8 Sep 2007 13:18:47 -0600 (MDT)

Author: grothoff
Date: 2007-09-08 13:18:45 -0600 (Sat, 08 Sep 2007)
New Revision: 5601

Modified:
   libmicrohttpd/src/daemon/connection.c
   libmicrohttpd/src/daemon/daemon.c
Log:
use shutdown

Modified: libmicrohttpd/src/daemon/connection.c
===================================================================
--- libmicrohttpd/src/daemon/connection.c       2007-09-08 10:51:09 UTC (rev 
5600)
+++ libmicrohttpd/src/daemon/connection.c       2007-09-08 19:18:45 UTC (rev 
5601)
@@ -187,6 +187,7 @@
 static void 
 connection_close_error(struct MHD_Connection * connection) 
 {
+  SHUTDOWN (connection->socket_fd, SHUT_RDWR);
   CLOSE (connection->socket_fd);
   connection->socket_fd = -1;
   if (connection->daemon->notify_completed != NULL) 
@@ -1301,6 +1302,7 @@
            MHD_DLOG (connection->daemon,
                      "Closing connection (http 1.0 or end-of-stream for 
unknown content length)\n");
 #endif
+           SHUTDOWN (connection->socket_fd, SHUT_RDWR);
             CLOSE (connection->socket_fd);
          }
           connection->socket_fd = -1;

Modified: libmicrohttpd/src/daemon/daemon.c
===================================================================
--- libmicrohttpd/src/daemon/daemon.c   2007-09-08 10:51:09 UTC (rev 5600)
+++ libmicrohttpd/src/daemon/daemon.c   2007-09-08 19:18:45 UTC (rev 5601)
@@ -228,6 +228,7 @@
       MHD_DLOG (con->daemon, 
                "Processing thread terminating, closing connection\n");
 #endif
+      SHUTDOWN (con->socket_fd, SHUT_RDWR);
       CLOSE (con->socket_fd);
       con->socket_fd = -1;
     }
@@ -258,8 +259,10 @@
   if ((s < 0) || (addrlen <= 0))
     {
       MHD_DLOG (daemon, "Error accepting connection: %s\n", STRERROR (errno));
-      if (s != -1)
+      if (s != -1) {
+       SHUTDOWN (s, SHUT_RDWR);
         CLOSE (s);              /* just in case */
+      }
       return MHD_NO;
     }
   if (daemon->max_connections == 0)
@@ -267,6 +270,7 @@
       /* above connection limit - reject */
       MHD_DLOG (daemon,
                 "Server reached connection limit (closing inbound 
connection)\n");
+      SHUTDOWN (s, SHUT_RDWR);
       CLOSE (s);
       return MHD_NO;
     }
@@ -277,6 +281,7 @@
       MHD_DLOG (daemon, 
                "Connection rejected, closing connection\n");
 #endif
+      SHUTDOWN (s, SHUT_RDWR);
       CLOSE (s);
       return MHD_YES;
     }
@@ -284,6 +289,7 @@
   if (connection == NULL)
     {
       MHD_DLOG (daemon, "Error allocating memory: %s\n", STRERROR (errno));
+      SHUTDOWN (s, SHUT_RDWR);
       CLOSE (s);
       return MHD_NO;
     }
@@ -293,6 +299,7 @@
   if (connection->addr == NULL)
     {
       MHD_DLOG (daemon, "Error allocating memory: %s\n", STRERROR (errno));
+      SHUTDOWN (s, SHUT_RDWR);
       CLOSE (s);
       free (connection);
       return MHD_NO;
@@ -306,6 +313,7 @@
                             NULL, &MHD_handle_connection, connection)))
     {
       MHD_DLOG (daemon, "Failed to create a thread: %s\n", STRERROR (errno));
+      SHUTDOWN (s, SHUT_RDWR);
       CLOSE (s);
       free (connection->addr);
       free (connection);
@@ -352,6 +360,7 @@
          MHD_DLOG (daemon, 
                    "Connection timed out, closing connection\n");
 #endif
+         SHUTDOWN (pos->socket_fd, SHUT_RDWR);
           CLOSE (pos->socket_fd);
           pos->socket_fd = -1;
          if (pos->daemon->notify_completed != NULL) 
@@ -747,7 +756,8 @@
                                     daemon->connections,
                                     &daemon->connections->client_context,
                                     MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN);
-         CLOSE (daemon->connections->socket_fd);
+         SHUTDOWN (daemon->connections->socket_fd, SHUT_RDWR);
+         CLOSE (daemon->connections->socket_fd);
           daemon->connections->socket_fd = -1;
         }
       MHD_cleanup_connections (daemon);





reply via email to

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