diff options
author | Julius Bünger <buenger@mytum.de> | 2015-07-29 12:26:14 +0000 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2015-07-29 12:26:14 +0000 |
commit | 19dec18b4506e0e3c6adf51120bde6150de30950 (patch) | |
tree | 924f93b70441c43d296e770f850e6b1cf9c48036 /src/rps | |
parent | 6b374e1e11ded5937e95a65f488211235b13ba63 (diff) | |
download | gnunet-19dec18b4506e0e3c6adf51120bde6150de30950.tar.gz gnunet-19dec18b4506e0e3c6adf51120bde6150de30950.zip |
-fixes and improvements
Diffstat (limited to 'src/rps')
-rw-r--r-- | src/rps/gnunet-service-rps.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index 1a6654003..f279b88d6 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c | |||
@@ -1962,7 +1962,7 @@ handle_client_act_malicious (void *cls, | |||
1962 | &attacked_peer)) | 1962 | &attacked_peer)) |
1963 | { | 1963 | { |
1964 | att_ctx = create_peer_ctx (&attacked_peer); | 1964 | att_ctx = create_peer_ctx (&attacked_peer); |
1965 | set_peer_flag (att_ctx, VALID); | 1965 | check_peer_live (att_ctx); |
1966 | } | 1966 | } |
1967 | 1967 | ||
1968 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1968 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -2053,7 +2053,7 @@ do_mal_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
2053 | * That is one push per round as it will ignore more. | 2053 | * That is one push per round as it will ignore more. |
2054 | */ | 2054 | */ |
2055 | peer_ctx = get_peer_ctx (&attacked_peer); | 2055 | peer_ctx = get_peer_ctx (&attacked_peer); |
2056 | if (NULL == peer_ctx->transmit_handle) | 2056 | if (GNUNET_YES == get_peer_flag (peer_ctx, VALID)) |
2057 | send_push (&attacked_peer); | 2057 | send_push (&attacked_peer); |
2058 | } | 2058 | } |
2059 | 2059 | ||
@@ -2317,7 +2317,7 @@ do_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
2317 | GNUNET_i2s (&push_list[i])); | 2317 | GNUNET_i2s (&push_list[i])); |
2318 | RPS_sampler_update (prot_sampler, &push_list[i]); | 2318 | RPS_sampler_update (prot_sampler, &push_list[i]); |
2319 | RPS_sampler_update (client_sampler, &push_list[i]); | 2319 | RPS_sampler_update (client_sampler, &push_list[i]); |
2320 | // TODO set in_flag? | 2320 | peer_clean (&push_list[i]); /* This cleans only if it is not in the view */ |
2321 | } | 2321 | } |
2322 | 2322 | ||
2323 | for (i = 0; i < pull_list_size; i++) | 2323 | for (i = 0; i < pull_list_size; i++) |
@@ -2327,7 +2327,7 @@ do_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
2327 | GNUNET_i2s (&pull_list[i])); | 2327 | GNUNET_i2s (&pull_list[i])); |
2328 | RPS_sampler_update (prot_sampler, &pull_list[i]); | 2328 | RPS_sampler_update (prot_sampler, &pull_list[i]); |
2329 | RPS_sampler_update (client_sampler, &pull_list[i]); | 2329 | RPS_sampler_update (client_sampler, &pull_list[i]); |
2330 | // TODO set in_flag? | 2330 | peer_clean (&pull_list[i]); /* This cleans only if it is not in the view */ |
2331 | } | 2331 | } |
2332 | 2332 | ||
2333 | 2333 | ||
@@ -2411,7 +2411,7 @@ peer_remove_cb (void *cls, const struct GNUNET_PeerIdentity *key, void *value) | |||
2411 | set_peer_flag (peer_ctx, TO_DESTROY); | 2411 | set_peer_flag (peer_ctx, TO_DESTROY); |
2412 | 2412 | ||
2413 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2413 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2414 | "Going to clean peer %s\n", | 2414 | "Going to remove peer %s\n", |
2415 | GNUNET_i2s (&peer_ctx->peer_id)); | 2415 | GNUNET_i2s (&peer_ctx->peer_id)); |
2416 | 2416 | ||
2417 | /* If operations are still scheduled for this peer cancel those */ | 2417 | /* If operations are still scheduled for this peer cancel those */ |
@@ -2435,10 +2435,19 @@ peer_remove_cb (void *cls, const struct GNUNET_PeerIdentity *key, void *value) | |||
2435 | 2435 | ||
2436 | unset_peer_flag (peer_ctx, PULL_REPLY_PENDING); | 2436 | unset_peer_flag (peer_ctx, PULL_REPLY_PENDING); |
2437 | 2437 | ||
2438 | to_file (file_name_view_log, | 2438 | /* Remove peer from view */ |
2439 | "-%s\t(cleanup channel, other peer)", | 2439 | if (GNUNET_CONTAINER_multipeermap_contains (view, key)) |
2440 | GNUNET_i2s_full (key)); | 2440 | { |
2441 | GNUNET_CONTAINER_multipeermap_remove_all (view, key); | 2441 | to_file (file_name_view_log, |
2442 | "-%s\t(cleanup channel, other peer)", | ||
2443 | GNUNET_i2s_full (key)); | ||
2444 | GNUNET_CONTAINER_multipeermap_remove_all (view, key); | ||
2445 | if (NULL != view_array) | ||
2446 | { | ||
2447 | GNUNET_free (view_array); | ||
2448 | view_array = NULL; | ||
2449 | } | ||
2450 | } | ||
2442 | 2451 | ||
2443 | /* If there is still a mq destroy it */ | 2452 | /* If there is still a mq destroy it */ |
2444 | if (NULL != peer_ctx->mq) | 2453 | if (NULL != peer_ctx->mq) |
@@ -2489,8 +2498,10 @@ peer_clean (const struct GNUNET_PeerIdentity *peer) | |||
2489 | struct PeerContext *peer_ctx; | 2498 | struct PeerContext *peer_ctx; |
2490 | /* struct GNUNET_CADET_Channel *channel; */ | 2499 | /* struct GNUNET_CADET_Channel *channel; */ |
2491 | 2500 | ||
2492 | if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (view, peer) && | 2501 | if ( (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (view, peer)) && |
2493 | GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (peer_map, peer)) | 2502 | (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (peer_map, peer)) && |
2503 | (GNUNET_NO == in_arr (push_list, push_list_size, peer)) && | ||
2504 | (GNUNET_NO == in_arr (pull_list, pull_list_size, peer)) ) | ||
2494 | { | 2505 | { |
2495 | peer_ctx = get_peer_ctx (peer); | 2506 | peer_ctx = get_peer_ctx (peer); |
2496 | 2507 | ||