gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated (d269419d2 -> b5c8dbf1f)


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated (d269419d2 -> b5c8dbf1f)
Date: Mon, 29 Oct 2018 18:07:32 +0100

This is an automated email from the git hooks/post-receive script.

julius-buenger pushed a change to branch master
in repository gnunet.

    from d269419d2 doc/man: More fixes.
     new 255670708 RPS service: cleanup (unused) data structures
     new 978440fd8 RPS utils: Use proper size for writing to file
     new 1d59b2b7a RPS service: separate values with newline when writing to 
file
     new b5c8dbf1f RPS: Use GNUNET_MIN instead of own min

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/rps/gnunet-service-rps.c      | 17 ++++++++---------
 src/rps/gnunet-service-rps_view.c |  2 ++
 src/rps/rps-test_util.c           |  3 +--
 src/rps/rps-test_util.h           |  4 ++--
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index 288a79e7a..c7217351f 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -953,7 +953,6 @@ remove_channel_ctx (struct ChannelCtx *channel_ctx)
 struct GNUNET_CADET_Channel *
 get_channel (struct PeerContext *peer_ctx)
 {
-  struct GNUNET_PeerIdentity *ctx_peer;
   /* There exists a copy-paste-clone in run() */
   struct GNUNET_MQ_MessageHandler cadet_handlers[] = {
     GNUNET_MQ_hd_fixed_size (peer_check,
@@ -981,8 +980,6 @@ get_channel (struct PeerContext *peer_ctx)
     LOG (GNUNET_ERROR_TYPE_DEBUG,
          "Trying to establish channel to peer %s\n",
          GNUNET_i2s (&peer_ctx->peer_id));
-    ctx_peer = GNUNET_new (struct GNUNET_PeerIdentity);
-    *ctx_peer = peer_ctx->peer_id;
     peer_ctx->send_channel_ctx = add_channel_ctx (peer_ctx);
     peer_ctx->send_channel_ctx->channel =
       GNUNET_CADET_channel_create (cadet_handle,
@@ -1845,7 +1842,6 @@ handle_inbound_channel (void *cls,
                         const struct GNUNET_PeerIdentity *initiator)
 {
   struct PeerContext *peer_ctx;
-  struct GNUNET_PeerIdentity *ctx_peer;
   struct ChannelCtx *channel_ctx;
   struct Sub *sub = cls;
 
@@ -1857,8 +1853,6 @@ handle_inbound_channel (void *cls,
   peer_ctx = create_or_get_peer_ctx (sub, initiator);
   set_peer_online (peer_ctx);
   (void) add_valid_peer (&peer_ctx->peer_id, peer_ctx->sub->valid_peers);
-  ctx_peer = GNUNET_new (struct GNUNET_PeerIdentity);
-  *ctx_peer = *initiator;
   channel_ctx = add_channel_ctx (peer_ctx);
   channel_ctx->channel = channel;
   /* We only accept one incoming channel per peer */
@@ -2907,7 +2901,7 @@ destroy_sub (struct Sub *sub)
   for (uint32_t i = 0; i < 256; i++)
   {
     char push_recv_str_tmp[8];
-    (void) snprintf (push_recv_str_tmp, 8, "%" PRIu32 ", ", sub->push_recv[i]);
+    (void) snprintf (push_recv_str_tmp, 8, "%" PRIu32 "\n", sub->push_recv[i]);
     LOG (GNUNET_ERROR_TYPE_DEBUG,
          "Adding str `%s' to `%s'\n",
          push_recv_str_tmp,
@@ -2916,6 +2910,9 @@ destroy_sub (struct Sub *sub)
                     push_recv_str_tmp,
                     1535 - strnlen (push_recv_str, 1536));
   }
+  (void) strncat (push_recv_str,
+                  "\n",
+                  1535 - strnlen (push_recv_str, 1536));
   LOG (GNUNET_ERROR_TYPE_DEBUG, "Writing push stats to disk\n");
   to_file_w_len (sub->file_name_push_recv, 1535, push_recv_str);
   GNUNET_free (sub->file_name_push_recv);
@@ -2925,7 +2922,7 @@ destroy_sub (struct Sub *sub)
   for (uint32_t i = 0; i < 256; i++)
   {
     char pull_delays_str_tmp[8];
-    (void) snprintf (pull_delays_str_tmp, 8, "%" PRIu32 ", ", 
sub->pull_delays[i]);
+    (void) snprintf (pull_delays_str_tmp, 8, "%" PRIu32 "\n", 
sub->pull_delays[i]);
     LOG (GNUNET_ERROR_TYPE_DEBUG,
          "Adding str `%s' to `%s'\n",
          pull_delays_str_tmp,
@@ -2934,6 +2931,9 @@ destroy_sub (struct Sub *sub)
                     pull_delays_str_tmp,
                     1535 - strnlen (pull_delays_str, 1536));
   }
+  (void) strncat (pull_delays_str,
+                  "\n",
+                  1535 - strnlen (pull_delays_str, 1536));
   LOG (GNUNET_ERROR_TYPE_DEBUG, "Writing pull delays to disk\n");
   to_file_w_len (sub->file_name_pull_delays, 1535, pull_delays_str);
   GNUNET_free (sub->file_name_pull_delays);
@@ -4487,7 +4487,6 @@ run (void *cls,
      const struct GNUNET_CONFIGURATION_Handle *c,
      struct GNUNET_SERVICE_Handle *service)
 {
-  char *fn_valid_peers;
   struct GNUNET_TIME_Relative round_interval;
   long long unsigned int sampler_size;
   char hash_port_string[] = GNUNET_APPLICATION_PORT_RPS;
diff --git a/src/rps/gnunet-service-rps_view.c 
b/src/rps/gnunet-service-rps_view.c
index 3af858e60..17fec559d 100644
--- a/src/rps/gnunet-service-rps_view.c
+++ b/src/rps/gnunet-service-rps_view.c
@@ -282,7 +282,9 @@ View_destroy (struct View *view)
 {
   View_clear (view);
   GNUNET_free (view->array);
+  view->array = NULL;
   GNUNET_CONTAINER_multipeermap_destroy (view->mpm);
+  GNUNET_free (view);
 }
 
 /* end of gnunet-service-rps_view.c */
diff --git a/src/rps/rps-test_util.c b/src/rps/rps-test_util.c
index f3367e01b..a6ea033cd 100644
--- a/src/rps/rps-test_util.c
+++ b/src/rps/rps-test_util.c
@@ -45,7 +45,6 @@
 
 #ifdef TO_FILE
 
-#define min(x,y) ((x) > (y) ? (y) : (x))
 
 /**
  * @brief buffer for storing the unaligned bits for the next write
@@ -201,7 +200,7 @@ to_file_raw_unaligned (const char *file_name,
     LOG (GNUNET_ERROR_TYPE_DEBUG,
         "number of bits needed to align unaligned bit: %u\n",
          num_bits_to_align);
-    num_bits_to_move  = min (num_bits_to_align, num_bits_needed_iter);
+    num_bits_to_move  = GNUNET_MIN (num_bits_to_align, num_bits_needed_iter);
     LOG (GNUNET_ERROR_TYPE_DEBUG,
         "number of bits of new byte to move: %u\n",
          num_bits_to_move);
diff --git a/src/rps/rps-test_util.h b/src/rps/rps-test_util.h
index 11093420e..a806f11cd 100644
--- a/src/rps/rps-test_util.h
+++ b/src/rps/rps-test_util.h
@@ -49,7 +49,7 @@ create_file (const char *name);
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,\
            "Failed to create tmp_buf\n");\
     else\
-      GNUNET_DISK_fn_write(file_name,tmp_buf, sizeof(tmp_buf),\
+      GNUNET_DISK_fn_write(file_name, tmp_buf, strnlen(tmp_buf, 512),\
                             GNUNET_DISK_PERM_USER_READ |\
                             GNUNET_DISK_PERM_USER_WRITE |\
                             GNUNET_DISK_PERM_GROUP_READ |\
@@ -64,7 +64,7 @@ create_file (const char *name);
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,\
            "Failed to create tmp_buf\n");\
     else\
-      GNUNET_DISK_fn_write(file_name,tmp_buf, len, \
+      GNUNET_DISK_fn_write(file_name, tmp_buf, strnlen(tmp_buf, len), \
                             GNUNET_DISK_PERM_USER_READ |\
                             GNUNET_DISK_PERM_USER_WRITE |\
                             GNUNET_DISK_PERM_GROUP_READ |\

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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