-dce
[oweals/gnunet.git] / src / util / server_mst.c
index 61617706e31c241b3035ca94b154c1fe7b9e9181..9dd04f0faf00739060483f52ec7e20013f13a474 100644 (file)
@@ -31,7 +31,6 @@
 #include "gnunet_server_lib.h"
 #include "gnunet_time_lib.h"
 
-#define DEBUG_SERVER_MST GNUNET_EXTRA_LOGGING 
 
 #if HAVE_UNALIGNED_64_ACCESS
 #define ALIGN_FACTOR 4
@@ -134,11 +133,9 @@ GNUNET_SERVER_mst_receive (struct GNUNET_SERVER_MessageStreamTokenizer *mst,
 
   GNUNET_assert (mst->off <= mst->pos);
   GNUNET_assert (mst->pos <= mst->curr_buf);
-#if DEBUG_SERVER_MST
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Server-mst receives %u bytes with %u bytes already in private buffer\n",
        (unsigned int) size, (unsigned int) (mst->pos - mst->off));
-#endif
   ret = GNUNET_OK;
   ibuf = (char *) mst->hdr;
   while (mst->pos > 0)
@@ -224,7 +221,8 @@ do_align:
     if (one_shot == GNUNET_YES)
       one_shot = GNUNET_SYSERR;
     mst->off += want;
-    mst->cb (mst->cb_cls, client_identity, hdr);
+    if (GNUNET_SYSERR == mst->cb (mst->cb_cls, client_identity, hdr))
+      return GNUNET_SYSERR;
     if (mst->off == mst->pos)
     {
       /* reset to beginning of buffer, it's free right now! */
@@ -235,11 +233,9 @@ do_align:
   GNUNET_assert (0 == mst->pos);
   while (size > 0)
   {
-#if DEBUG_SERVER_MST
     LOG (GNUNET_ERROR_TYPE_DEBUG,
          "Server-mst has %u bytes left in inbound buffer\n",
          (unsigned int) size);
-#endif
     if (size < sizeof (struct GNUNET_MessageHeader))
       break;
     offset = (unsigned long) buf;
@@ -266,7 +262,8 @@ do_align:
       }
       if (one_shot == GNUNET_YES)
         one_shot = GNUNET_SYSERR;
-      mst->cb (mst->cb_cls, client_identity, hdr);
+      if (GNUNET_SYSERR == mst->cb (mst->cb_cls, client_identity, hdr))
+        return GNUNET_SYSERR;
       buf += want;
       size -= want;
     }
@@ -295,11 +292,9 @@ copy:
     mst->off = 0;
     mst->pos = 0;
   }
-#if DEBUG_SERVER_MST
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Server-mst leaves %u bytes in private buffer\n",
        (unsigned int) (mst->pos - mst->off));
-#endif
   return ret;
 }