gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r10395 - gnunet/src/datastore


From: gnunet
Subject: [GNUnet-SVN] r10395 - gnunet/src/datastore
Date: Mon, 22 Feb 2010 11:48:44 +0100

Author: grothoff
Date: 2010-02-22 11:48:44 +0100 (Mon, 22 Feb 2010)
New Revision: 10395

Modified:
   gnunet/src/datastore/gnunet-service-datastore.c
   gnunet/src/datastore/plugin_datastore_sqlite.c
Log:
fix cleanup

Modified: gnunet/src/datastore/gnunet-service-datastore.c
===================================================================
--- gnunet/src/datastore/gnunet-service-datastore.c     2010-02-22 10:11:28 UTC 
(rev 10394)
+++ gnunet/src/datastore/gnunet-service-datastore.c     2010-02-22 10:48:44 UTC 
(rev 10395)
@@ -930,6 +930,7 @@
       GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
       return;
     }
+  GNUNET_SERVER_client_keep (client);
   msg = (const struct GetMessage*) message;
   if ( (size == sizeof(struct GetMessage)) &&
        (GNUNET_YES != GNUNET_CONTAINER_bloomfilter_test (filter,
@@ -942,13 +943,11 @@
                  "GET",
                  GNUNET_h2s (&msg->key));
 #endif 
-      GNUNET_SERVER_client_keep (client);
       transmit_item (client,
                     NULL, NULL, 0, NULL, 0, 0, 0, 
                     GNUNET_TIME_UNIT_ZERO_ABS, 0);
       return;
     }
-  GNUNET_SERVER_client_keep (client);
   plugin->api->get (plugin->api->cls,
                    ((size == sizeof(struct GetMessage)) ? &msg->key : NULL),
                    NULL,
@@ -1236,6 +1235,20 @@
 static void
 cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
+  struct TransmitCallbackContext *tcc;
+
+  while (NULL != (tcc = tcc_head))
+    {
+      GNUNET_CONTAINER_DLL_remove (tcc_head,
+                                  tcc_tail,
+                                  tcc);
+      if (tcc->th != NULL)
+       GNUNET_CONNECTION_notify_transmit_ready_cancel (tcc->th);
+      if (NULL != tcc->tc)
+       tcc->tc (tcc->tc_cls, GNUNET_SYSERR);
+      GNUNET_free (tcc->msg);
+      GNUNET_free (tcc);
+    }
   if (expired_kill_task != GNUNET_SCHEDULER_NO_TASK)
     {
       GNUNET_SCHEDULER_cancel (sched,
@@ -1296,36 +1309,6 @@
 
 
 /**
- * Function that removes all active reservations made
- * by the given client and releases the space for other
- * requests.
- *
- * @param cls closure
- * @param client identification of the client
- */
-static void
-cleanup_transmits (void *cls,
-                  struct GNUNET_SERVER_Client
-                  * client)
-{
-  struct TransmitCallbackContext *tcc;
-
-  while (NULL != (tcc = tcc_head))
-    {
-      GNUNET_CONTAINER_DLL_remove (tcc_head,
-                                  tcc_tail,
-                                  tcc);
-      if (tcc->th != NULL)
-       GNUNET_CONNECTION_notify_transmit_ready_cancel (tcc->th);
-      GNUNET_free (tcc->msg);
-      GNUNET_free (tcc);
-    }
-
-}
-
-
-
-/**
  * Process datastore requests.
  *
  * @param cls closure
@@ -1389,7 +1372,6 @@
       return;
     }
   GNUNET_SERVER_disconnect_notify (server, &cleanup_reservations, NULL);
-  GNUNET_SERVER_disconnect_notify (server, &cleanup_transmits, NULL);
   GNUNET_SERVER_add_handlers (server, handlers);
   expired_kill_task
     = GNUNET_SCHEDULER_add_with_priority (sched,

Modified: gnunet/src/datastore/plugin_datastore_sqlite.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_sqlite.c      2010-02-22 10:11:28 UTC 
(rev 10394)
+++ gnunet/src/datastore/plugin_datastore_sqlite.c      2010-02-22 10:48:44 UTC 
(rev 10395)
@@ -1427,7 +1427,7 @@
       sqlite_plugin_iter_low_priority (cls, type, iter, iter_cls);
       return;
     }
-  GNUNET_snprintf (scratch, 256,
+  GNUNET_snprintf (scratch, sizeof (scratch),
                    "SELECT count(*) FROM gn080 WHERE hash=:1%s%s",
                    vhash == NULL ? "" : " AND vhash=:2",
                    type == 0 ? "" : (vhash ==
@@ -1479,7 +1479,7 @@
       return;
     }
 
-  GNUNET_snprintf (scratch, 256,
+  GNUNET_snprintf (scratch, sizeof (scratch),
                    "SELECT size, type, prio, anonLevel, expire, hash, value, 
_ROWID_ "
                    "FROM gn080 WHERE hash=:1%s%s AND _ROWID_ >= :%d "
                    "ORDER BY _ROWID_ ASC LIMIT 1 OFFSET :d",





reply via email to

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