glitch in the license text detected by hyazinthe, thank you!
[oweals/gnunet.git] / src / set / gnunet-service-set_union.c
index 4ca10f0b463791b14b57667c4a56b94c0203a05a..440d0d1b0d9974399df6fd9575e46958a1aa9c9f 100644 (file)
@@ -2,20 +2,15 @@
       This file is part of GNUnet
       Copyright (C) 2013-2017 GNUnet e.V.
 
-      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 3, or (at your
-      option) any later version.
+      GNUnet is free software: you can redistribute it and/or modify it
+      under the terms of the GNU Affero General Public License as published
+      by the Free Software Foundation, either version 3 of the License,
+      or (at your option) any later version.
 
       GNUnet is distributed in the hope that it will be useful, but
       WITHOUT ANY WARRANTY; without even the implied warranty of
       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-      General Public License for more details.
-
-      You should have received a copy of the GNU General Public License
-      along with GNUnet; see the file COPYING.  If not, write to the
-      Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-      Boston, MA 02110-1301, USA.
+      Affero General Public License for more details.
 */
 /**
  * @file set/gnunet-service-set_union.c
@@ -364,7 +359,7 @@ fail_union_operation (struct Operation *op)
   struct GNUNET_MQ_Envelope *ev;
   struct GNUNET_SET_ResultMessage *msg;
 
-  LOG (GNUNET_ERROR_TYPE_ERROR,
+  LOG (GNUNET_ERROR_TYPE_WARNING,
        "union operation failed\n");
   ev = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_SET_RESULT);
   msg->result_status = htons (GNUNET_SET_STATUS_FAILURE);
@@ -389,10 +384,11 @@ get_ibf_key (const struct GNUNET_HashCode *src)
   struct IBF_Key key;
   uint16_t salt = 0;
 
-  GNUNET_CRYPTO_kdf (&key, sizeof (key),
-                     src, sizeof *src,
-                     &salt, sizeof (salt),
-                     NULL, 0);
+  GNUNET_assert (GNUNET_OK ==
+                GNUNET_CRYPTO_kdf (&key, sizeof (key),
+                                   src, sizeof *src,
+                                   &salt, sizeof (salt),
+                                   NULL, 0));
   return key;
 }
 
@@ -739,11 +735,10 @@ get_order_from_difference (unsigned int diff)
   unsigned int ibf_order;
 
   ibf_order = 2;
-  while ( (1<<ibf_order) < (IBF_ALPHA * diff) ||
-          ((1<<ibf_order) < SE_IBF_HASH_NUM) )
+  while ( ( (1<<ibf_order) < (IBF_ALPHA * diff) ||
+            ((1<<ibf_order) < SE_IBF_HASH_NUM) ) &&
+          (ibf_order < MAX_IBF_ORDER) )
     ibf_order++;
-  if (ibf_order > MAX_IBF_ORDER)
-    ibf_order = MAX_IBF_ORDER;
   // add one for correction
   return ibf_order + 1;
 }
@@ -1405,7 +1400,7 @@ send_client_done (void *cls)
   }
 
   if (PHASE_DONE != op->state->phase) {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
+    LOG (GNUNET_ERROR_TYPE_WARNING,
          "union operation failed\n");
     ev = GNUNET_MQ_msg (rm, GNUNET_MESSAGE_TYPE_SET_RESULT);
     rm->result_status = htons (GNUNET_SET_STATUS_FAILURE);
@@ -1467,8 +1462,6 @@ maybe_finish (struct Operation *op)
          num_demanded);
     if (0 == num_demanded)
     {
-      struct GNUNET_MQ_Envelope *ev;
-
       op->state->phase = PHASE_DONE;
       send_client_done (op);
       destroy_channel (op);
@@ -1894,8 +1887,6 @@ handle_union_p2p_full_done (void *cls,
     break;
   case PHASE_FULL_SENDING:
     {
-      struct GNUNET_MQ_Envelope *ev;
-
       LOG (GNUNET_ERROR_TYPE_DEBUG,
            "got FULL DONE, finishing\n");
       /* We sent the full set, and got the response for that.  We're done. */