[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r15737 - libmicrohttpd/src/daemon
From: |
gnunet |
Subject: |
[GNUnet-SVN] r15737 - libmicrohttpd/src/daemon |
Date: |
Wed, 22 Jun 2011 10:08:08 +0200 |
Author: grothoff
Date: 2011-06-22 10:08:07 +0200 (Wed, 22 Jun 2011)
New Revision: 15737
Modified:
libmicrohttpd/src/daemon/daemon.c
Log:
must insert into DLL before creating thread
Modified: libmicrohttpd/src/daemon/daemon.c
===================================================================
--- libmicrohttpd/src/daemon/daemon.c 2011-06-22 07:01:29 UTC (rev 15736)
+++ libmicrohttpd/src/daemon/daemon.c 2011-06-22 08:08:07 UTC (rev 15737)
@@ -1054,6 +1054,24 @@
}
#endif
+ if (0 != pthread_mutex_lock(&daemon->cleanup_connection_mutex))
+ {
+#if HAVE_MESSAGES
+ MHD_DLOG (daemon, "Failed to acquire cleanup mutex\n");
+#endif
+ abort();
+ }
+ DLL_insert (daemon->connections_head,
+ daemon->connections_tail,
+ connection);
+ if (0 != pthread_mutex_unlock(&daemon->cleanup_connection_mutex))
+ {
+#if HAVE_MESSAGES
+ MHD_DLOG (daemon, "Failed to release cleanup mutex\n");
+#endif
+ abort();
+ }
+
/* attempt to create handler thread */
if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
{
@@ -1068,28 +1086,28 @@
SHUTDOWN (client_socket, SHUT_RDWR);
CLOSE (client_socket);
MHD_ip_limit_del (daemon, addr, addrlen);
+ if (0 != pthread_mutex_lock(&daemon->cleanup_connection_mutex))
+ {
+#if HAVE_MESSAGES
+ MHD_DLOG (daemon, "Failed to acquire cleanup mutex\n");
+#endif
+ abort();
+ }
+ DLL_remove (daemon->connections_head,
+ daemon->connections_tail,
+ connection);
+ if (0 != pthread_mutex_unlock(&daemon->cleanup_connection_mutex))
+ {
+#if HAVE_MESSAGES
+ MHD_DLOG (daemon, "Failed to release cleanup mutex\n");
+#endif
+ abort();
+ }
free (connection->addr);
free (connection);
return MHD_NO;
}
}
- if (0 != pthread_mutex_lock(&daemon->cleanup_connection_mutex))
- {
-#if HAVE_MESSAGES
- MHD_DLOG (daemon, "Failed to acquire cleanup mutex\n");
-#endif
- abort();
- }
- DLL_insert (daemon->connections_head,
- daemon->connections_tail,
- connection);
- if (0 != pthread_mutex_unlock(&daemon->cleanup_connection_mutex))
- {
-#if HAVE_MESSAGES
- MHD_DLOG (daemon, "Failed to release cleanup mutex\n");
-#endif
- abort();
- }
daemon->max_connections--;
return MHD_YES;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r15737 - libmicrohttpd/src/daemon,
gnunet <=