[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] 02/02: fix rps service/test: handle pending messag
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] 02/02: fix rps service/test: handle pending messages properly |
Date: |
Wed, 27 Jun 2018 04:00:15 +0200 |
This is an automated email from the git hooks/post-receive script.
julius-buenger pushed a commit to branch master
in repository gnunet.
commit 6ac64e16ee69704579ebfd942183e04f32f60590
Author: Julius Bünger <address@hidden>
AuthorDate: Wed Jun 27 03:58:42 2018 +0200
fix rps service/test: handle pending messages properly
---
src/rps/gnunet-service-rps.c | 15 +++++++++------
src/rps/test_rps.c | 9 +++++++++
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index 55569866b..8fe64c2eb 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -724,7 +724,6 @@ mq_liveliness_check_successful (void *cls)
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Liveliness check for peer %s was successfull\n",
GNUNET_i2s (&peer_ctx->peer_id));
- //GNUNET_free (peer_ctx->liveliness_check_pending);
remove_pending_message (peer_ctx->liveliness_check_pending, GNUNET_YES);
peer_ctx->liveliness_check_pending = NULL;
set_peer_live (peer_ctx);
@@ -747,10 +746,6 @@ check_peer_live (struct PeerContext *peer_ctx)
struct GNUNET_MQ_Envelope *ev;
ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_RPS_PP_CHECK_LIVE);
- //peer_ctx->liveliness_check_pending = GNUNET_new (struct PendingMessage);
- //peer_ctx->liveliness_check_pending->ev = ev;
- //peer_ctx->liveliness_check_pending->peer_ctx = peer_ctx;
- //peer_ctx->liveliness_check_pending->type = "Check liveliness";
peer_ctx->liveliness_check_pending =
insert_pending_message (&peer_ctx->peer_id, ev, "Check liveliness");
mq = get_mq (&peer_ctx->peer_id);
@@ -1261,6 +1256,13 @@ Peers_remove_peer (const struct GNUNET_PeerIdentity
*peer)
"Removing unsent %s\n",
peer_ctx->pending_messages_head->type);
/* Cancle pending message, too */
+ if ( (NULL != peer_ctx->liveliness_check_pending) &&
+ (0 == memcmp (peer_ctx->pending_messages_head,
+ peer_ctx->liveliness_check_pending,
+ sizeof (struct PendingMessage))) )
+ {
+ peer_ctx->liveliness_check_pending = NULL;
+ }
remove_pending_message (peer_ctx->pending_messages_head, GNUNET_YES);
}
/* If we are still waiting for notification whether this peer is live
@@ -1272,7 +1274,7 @@ Peers_remove_peer (const struct GNUNET_PeerIdentity *peer)
GNUNET_i2s (&peer_ctx->peer_id));
// TODO wait until cadet sets mq->cancel_impl
//GNUNET_MQ_send_cancel (peer_ctx->liveliness_check_pending->ev);
- GNUNET_free (peer_ctx->liveliness_check_pending);
+ remove_pending_message (peer_ctx->liveliness_check_pending, GNUNET_YES);
peer_ctx->liveliness_check_pending = NULL;
}
channel_flag = Peers_get_channel_flag (peer, Peers_CHANNEL_ROLE_SENDING);
@@ -3596,6 +3598,7 @@ handle_client_act_malicious (void *cls,
num_mal_peers_sent = ntohl (msg->num_peers) - 1;
num_mal_peers_old = num_mal_peers;
+ GNUNET_assert (GNUNET_MAX_MALLOC_CHECKED > num_mal_peers_sent);
GNUNET_array_grow (mal_peers,
num_mal_peers,
num_mal_peers + num_mal_peers_sent);
diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c
index e7b82458a..08424022f 100644
--- a/src/rps/test_rps.c
+++ b/src/rps/test_rps.c
@@ -841,6 +841,13 @@ seed_peers (void *cls)
unsigned int amount;
unsigned int i;
+ if (GNUNET_YES == in_shutdown || GNUNET_YES == post_test)
+ {
+ return;
+ }
+
+ GNUNET_assert (NULL != peer->rps_handle);
+
// TODO if malicious don't seed mal peers
amount = round (.5 * num_peers);
@@ -998,9 +1005,11 @@ rps_connect_adapter (void *cls,
struct GNUNET_RPS_Handle *h;
h = GNUNET_RPS_connect (cfg);
+ GNUNET_assert (NULL != h);
if (NULL != cur_test_run.pre_test)
cur_test_run.pre_test (cls, h);
+ GNUNET_assert (NULL != h);
return h;
}
--
To stop receiving notification emails like this one, please contact
address@hidden