fix
[oweals/gnunet.git] / src / datastore / datastore_api.c
index 8719d48506516d4b4868b8c0c2ddc178b22c6eaa..21675b0b7c0fecb1b54858cf676ff1e793f3e9bb 100644 (file)
@@ -4,7 +4,7 @@
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 2, or (at your
+     by the Free Software Foundation; either version 3, or (at your
      option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
@@ -245,7 +245,7 @@ GNUNET_DATASTORE_connect (const struct
   if (c == NULL)
     return NULL; /* oops */
   h = GNUNET_malloc (sizeof(struct GNUNET_DATASTORE_Handle) + 
-                    GNUNET_SERVER_MAX_MESSAGE_SIZE);
+                    GNUNET_SERVER_MAX_MESSAGE_SIZE - 1);
   h->client = c;
   h->cfg = cfg;
   h->sched = sched;
@@ -684,12 +684,11 @@ process_status_message (void *cls,
       free_queue_entry (qe);
       if (NULL == h->client)
        return; /* forced disconnect */
+      rc.cont (rc.cont_cls, 
+              GNUNET_SYSERR,
+              _("Failed to receive response from database."));
       if (was_transmitted == GNUNET_YES)
-       {
-         GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                     _("Failed to receive response from database.\n"));
-         do_disconnect (h);
-       }
+       do_disconnect (h);
       return;
     }
   GNUNET_assert (GNUNET_YES == qe->was_transmitted);
@@ -790,7 +789,7 @@ GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h,
              GNUNET_h2s (key));
 #endif
   msize = sizeof(struct DataMessage) + size;
-  GNUNET_assert (msize <= GNUNET_SERVER_MAX_MESSAGE_SIZE);
+  GNUNET_assert (msize < GNUNET_SERVER_MAX_MESSAGE_SIZE);
   qc.sc.cont = cont;
   qc.sc.cont_cls = cont_cls;
   qe = make_queue_entry (h, msize,
@@ -1037,7 +1036,7 @@ GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h,
   qc.sc.cont = cont;
   qc.sc.cont_cls = cont_cls;
   msize = sizeof(struct DataMessage) + size;
-  GNUNET_assert (msize <= GNUNET_SERVER_MAX_MESSAGE_SIZE);
+  GNUNET_assert (msize < GNUNET_SERVER_MAX_MESSAGE_SIZE);
   qe = make_queue_entry (h, msize,
                         queue_priority, max_queue_size, timeout,
                         &process_status_message, &qc);
@@ -1079,7 +1078,7 @@ process_result_message (void *cls,
 
   h->in_receive = GNUNET_NO;
   if (msg == NULL)
-    {
+   {
       was_transmitted = qe->was_transmitted;
       free_queue_entry (qe);
       if (was_transmitted == GNUNET_YES)
@@ -1287,7 +1286,6 @@ GNUNET_DATASTORE_get_next (struct GNUNET_DATASTORE_Handle *h,
   struct GNUNET_DATASTORE_QueueEntry *qe = h->queue_head;
   struct ResultContext rc = qe->qc.rc;
 
-  GNUNET_assert (NULL != qe);
   GNUNET_assert (&process_result_message == qe->response_proc);
   if (GNUNET_YES == more)
     {