fixes
authorChristian Grothoff <christian@grothoff.org>
Fri, 12 Mar 2010 17:09:36 +0000 (17:09 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 12 Mar 2010 17:09:36 +0000 (17:09 +0000)
contrib/defaults.conf
src/core/gnunet-service-core.c
src/datastore/gnunet-service-datastore.c
src/fs/fs_test_lib_data.conf
src/util/connection.c
src/util/disk.c
src/util/server.c

index d469bf2a88eb2d9429a0fb3d928167cb040a2a1a..07bea373243eb5015348dd819b53668ee09f051e 100644 (file)
@@ -32,7 +32,7 @@ ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
 ALLOW_SHUTDOWN = YES
 DEFAULTSERVICES = resolver transport core topology hostlist
-GLOBAL_POSTFIX = -l $SERVICEHOME/{}-logs
+#GLOBAL_POSTFIX = -l $SERVICEHOME/{}-logs
 # GLOBAL_PREFIX =
 # USERNAME =
 # MAXBUF =
@@ -132,6 +132,7 @@ ALLOW_SHUTDOWN = YES
 # quotas are in bytes per second now!
 TOTAL_QUOTA_IN = 65536
 TOTAL_QUOTA_OUT = 65536
+DEBUG = YES
 # USERNAME = 
 # MAXBUF =
 # TIMEOUT =
index 1dd7e1d8bd7bcd65fd93772ee6b8199b2a21e195..8f22313e6d70830af2a8ea0be98cdb118146a7f8 100644 (file)
@@ -805,7 +805,14 @@ send_to_all_clients (const struct GNUNET_MessageHeader *msg,
   while (c != NULL)
     {
       if (0 != (c->options & options))
-       send_to_client (c, msg, can_drop);
+       {
+#if DEBUG_CORE_CLIENT
+         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                     "Sending message of type %u to client.\n",
+                     ntohs (msg->type));
+#endif
+         send_to_client (c, msg, can_drop);
+       }
       c = c->next;
     }
 }
@@ -885,7 +892,7 @@ handle_client_init (void *cls,
               "Sending `%s' message to client.\n", "INIT_REPLY");
 #endif
   send_to_client (c, &irm.header, GNUNET_NO);
-  if (c->options & GNUNET_CORE_OPTION_SEND_CONNECT)
+  if (0 != (c->options & GNUNET_CORE_OPTION_SEND_CONNECT))
     {
       /* notify new client about existing neighbours */
       cnm.header.size = htons (sizeof (struct ConnectNotifyMessage));
index 9f5d594b5721b083e024b26ae854d382b314b0b0..06f07f4743df30491d661497e8aef0f087de4070 100644 (file)
@@ -234,6 +234,11 @@ static struct TransmitCallbackContext *tcc_head;
  */
 static struct TransmitCallbackContext *tcc_tail;
 
+/**
+ * Have we already clean ed up the TCCs and are hence no longer
+ * willing (or able) to transmit anything to anyone?
+ */
+static int cleaning_done;
 
 /**
  * Task that is used to remove expired entries from
@@ -502,6 +507,12 @@ transmit (struct GNUNET_SERVER_Client *client,
 {
   struct TransmitCallbackContext *tcc;
 
+  if (GNUNET_YES == cleaning_done)
+    {
+      if (NULL != tc)
+       tc (tc_cls, GNUNET_SYSERR);
+      return;
+    }
   tcc = GNUNET_malloc (sizeof(struct TransmitCallbackContext));
   tcc->msg = msg;
   tcc->client = client;
@@ -1257,6 +1268,7 @@ cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct TransmitCallbackContext *tcc;
 
+  cleaning_done = GNUNET_YES;
   while (NULL != (tcc = tcc_head))
     {
       GNUNET_CONTAINER_DLL_remove (tcc_head,
index 70b47a9d857c594f6ca15c1663a6676b5680136a..20004ab16a702e0d0ee0f6cd081f1d9d28a85208 100644 (file)
@@ -21,6 +21,8 @@ DEFAULTSERVICES = resolver datastore transport core fs peerinfo
 
 [datastore]
 #DEBUG = YES
+#PREFIX = valgrind --tool=memcheck --leak-check=yes
+#BINARY = /home/grothoff/bin/gnunet-service-datastore
 
 [statistics]
 PORT = 43467
@@ -40,7 +42,9 @@ PORT = 43470
 HOSTNAME = localhost
 #TOTAL_QUOTA_IN = 3932160
 #TOTAL_QUOTA_OUT = 3932160
-#DEBUG = YES
+DEBUG = YES
+#PREFIX = valgrind --tool=memcheck --leak-check=yes
+#BINARY = /home/grothoff/bin/gnunet-service-core
 
 [fs]
 PORT = 43471
index 10f53dcf9fe6d63a1139a212bf8510d37b88e380..22a75691bead5905575b796a9edb748d8c723f8b 100644 (file)
@@ -931,11 +931,6 @@ void
 GNUNET_CONNECTION_destroy (struct GNUNET_CONNECTION_Handle *sock,
                           int finish_pending_write)
 {
-  if ((sock->write_buffer_off == 0) && (sock->dns_active != NULL))
-    {
-      GNUNET_RESOLVER_request_cancel (sock->dns_active);
-      sock->dns_active = NULL;
-    }
   if (GNUNET_NO == finish_pending_write)
     {
       if (sock->write_task != GNUNET_SCHEDULER_NO_TASK)
@@ -943,8 +938,14 @@ GNUNET_CONNECTION_destroy (struct GNUNET_CONNECTION_Handle *sock,
          GNUNET_SCHEDULER_cancel (sock->sched,
                                   sock->write_task);
          sock->write_task = GNUNET_SCHEDULER_NO_TASK;
+         sock->write_buffer_off = 0;
        }
     }
+  if ((sock->write_buffer_off == 0) && (sock->dns_active != NULL))
+    {
+      GNUNET_RESOLVER_request_cancel (sock->dns_active);
+      sock->dns_active = NULL;
+    }
   GNUNET_assert (sock->sched != NULL);
   GNUNET_SCHEDULER_add_now (sock->sched,
                            &destroy_continuation, sock);
index fa737843c7bb88034143d7d5df410b9056760d3e..588ecae3cc5dd3b606013032f8ee06d8425cc28c 100644 (file)
@@ -1239,7 +1239,10 @@ GNUNET_DISK_file_open (const char *fn,
   fd = open (expfn, oflags | O_LARGEFILE, mode);
   if (fd == -1)
     {
-      GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "open", expfn);
+      if (0 == (flags & GNUNET_DISK_OPEN_FAILIFEXISTS))
+       GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "open", expfn);
+      else
+       GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_DEBUG, "open", expfn);
       GNUNET_free (expfn);
       return NULL;
     }
index b3c03d71089c5c012dcb1b984c2762896631722b..1353d4c057c1412f9aee218aa49f732d3b1f90e1 100644 (file)
@@ -1198,7 +1198,7 @@ GNUNET_SERVER_client_disconnect (struct GNUNET_SERVER_Client *client)
     }
   if (rc > 0)
     return;
-  if (client->in_process_client_buffer)
+  if (client->in_process_client_buffer == GNUNET_YES)
     return;
   client->destroy (client->client_closure);
   GNUNET_free (client);