diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-12-27 14:49:55 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-12-27 14:49:55 +0100 |
commit | 966493710fe6e474827e9626291e39e1bd8050e9 (patch) | |
tree | ebe03f9e421c7117be3f7192c9268cfadc9936e8 /src/rps/gnunet-service-rps.c | |
parent | 4c462cd59d3b82e7e10711762f1b95a905609118 (diff) | |
download | gnunet-966493710fe6e474827e9626291e39e1bd8050e9.tar.gz gnunet-966493710fe6e474827e9626291e39e1bd8050e9.zip |
fix flow control issue
Diffstat (limited to 'src/rps/gnunet-service-rps.c')
-rw-r--r-- | src/rps/gnunet-service-rps.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index 0a4543b30..177be9085 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c | |||
@@ -1239,24 +1239,24 @@ handle_peer_push (void *cls, | |||
1239 | (3 == mal_type) ) | 1239 | (3 == mal_type) ) |
1240 | { /* Try to maximise representation */ | 1240 | { /* Try to maximise representation */ |
1241 | tmp_att_peer = GNUNET_new (struct AttackedPeer); | 1241 | tmp_att_peer = GNUNET_new (struct AttackedPeer); |
1242 | GNUNET_memcpy (&tmp_att_peer->peer_id, peer, sizeof (struct GNUNET_PeerIdentity)); | 1242 | tmp_att_peer->peer_id = *peer; |
1243 | if (NULL == att_peer_set) | 1243 | if (NULL == att_peer_set) |
1244 | att_peer_set = GNUNET_CONTAINER_multipeermap_create (1, GNUNET_NO); | 1244 | att_peer_set = GNUNET_CONTAINER_multipeermap_create (1, GNUNET_NO); |
1245 | if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (att_peer_set, | 1245 | if (GNUNET_NO == |
1246 | peer)) | 1246 | GNUNET_CONTAINER_multipeermap_contains (att_peer_set, |
1247 | peer)) | ||
1247 | { | 1248 | { |
1248 | GNUNET_CONTAINER_DLL_insert (att_peers_head, | 1249 | GNUNET_CONTAINER_DLL_insert (att_peers_head, |
1249 | att_peers_tail, | 1250 | att_peers_tail, |
1250 | tmp_att_peer); | 1251 | tmp_att_peer); |
1251 | add_peer_array_to_set (peer, 1, att_peer_set); | 1252 | add_peer_array_to_set (peer, 1, att_peer_set); |
1252 | } | 1253 | } |
1253 | GNUNET_CADET_receive_done (Peers_get_recv_channel (peer)); | ||
1254 | } | 1254 | } |
1255 | 1255 | ||
1256 | 1256 | ||
1257 | else if (2 == mal_type) | 1257 | else if (2 == mal_type) |
1258 | { /* We attack one single well-known peer - simply ignore */ | 1258 | { |
1259 | GNUNET_CADET_receive_done (Peers_get_recv_channel (peer)); | 1259 | /* We attack one single well-known peer - simply ignore */ |
1260 | } | 1260 | } |
1261 | #endif /* ENABLE_MALICIOUS */ | 1261 | #endif /* ENABLE_MALICIOUS */ |
1262 | 1262 | ||
@@ -1289,7 +1289,6 @@ handle_peer_pull_request (void *cls, | |||
1289 | || 3 == mal_type) | 1289 | || 3 == mal_type) |
1290 | { /* Try to maximise representation */ | 1290 | { /* Try to maximise representation */ |
1291 | send_pull_reply (peer, mal_peers, num_mal_peers); | 1291 | send_pull_reply (peer, mal_peers, num_mal_peers); |
1292 | GNUNET_CADET_receive_done (Peers_get_recv_channel (peer)); | ||
1293 | } | 1292 | } |
1294 | 1293 | ||
1295 | else if (2 == mal_type) | 1294 | else if (2 == mal_type) |
@@ -1298,7 +1297,6 @@ handle_peer_pull_request (void *cls, | |||
1298 | { | 1297 | { |
1299 | send_pull_reply (peer, mal_peers, num_mal_peers); | 1298 | send_pull_reply (peer, mal_peers, num_mal_peers); |
1300 | } | 1299 | } |
1301 | GNUNET_CADET_receive_done (Peers_get_recv_channel (peer)); | ||
1302 | } | 1300 | } |
1303 | #endif /* ENABLE_MALICIOUS */ | 1301 | #endif /* ENABLE_MALICIOUS */ |
1304 | 1302 | ||
@@ -1360,7 +1358,7 @@ static void | |||
1360 | handle_peer_pull_reply (void *cls, | 1358 | handle_peer_pull_reply (void *cls, |
1361 | const struct GNUNET_RPS_P2P_PullReplyMessage *msg) | 1359 | const struct GNUNET_RPS_P2P_PullReplyMessage *msg) |
1362 | { | 1360 | { |
1363 | struct GNUNET_PeerIdentity *peers; | 1361 | const struct GNUNET_PeerIdentity *peers; |
1364 | struct GNUNET_PeerIdentity *sender = cls; | 1362 | struct GNUNET_PeerIdentity *sender = cls; |
1365 | uint32_t i; | 1363 | uint32_t i; |
1366 | #ifdef ENABLE_MALICIOUS | 1364 | #ifdef ENABLE_MALICIOUS |
@@ -1373,12 +1371,11 @@ handle_peer_pull_reply (void *cls, | |||
1373 | // We shouldn't even receive pull replies as we're not sending | 1371 | // We shouldn't even receive pull replies as we're not sending |
1374 | if (2 == mal_type) | 1372 | if (2 == mal_type) |
1375 | { | 1373 | { |
1376 | GNUNET_CADET_receive_done (Peers_get_recv_channel (sender)); | ||
1377 | } | 1374 | } |
1378 | #endif /* ENABLE_MALICIOUS */ | 1375 | #endif /* ENABLE_MALICIOUS */ |
1379 | 1376 | ||
1380 | /* Do actual logic */ | 1377 | /* Do actual logic */ |
1381 | peers = (struct GNUNET_PeerIdentity *) &msg[1]; | 1378 | peers = (const struct GNUNET_PeerIdentity *) &msg[1]; |
1382 | 1379 | ||
1383 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1380 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1384 | "PULL REPLY received, got following %u peers:\n", | 1381 | "PULL REPLY received, got following %u peers:\n", |