diff options
author | Julius Bünger <buenger@mytum.de> | 2018-10-01 19:51:21 +0200 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2018-10-01 23:15:26 +0200 |
commit | c8e4a66007d1d904ccd78c0dbd0c101b43d83a14 (patch) | |
tree | 00ccf33f317d2d2a76bdaf1c970eeefcdb3140d1 /src/rps/gnunet-service-rps.c | |
parent | b1920f97583d6a75c4886715aa0335699c9af13a (diff) | |
download | gnunet-c8e4a66007d1d904ccd78c0dbd0c101b43d83a14.tar.gz gnunet-c8e4a66007d1d904ccd78c0dbd0c101b43d83a14.zip |
Rename "live" -> online
Diffstat (limited to 'src/rps/gnunet-service-rps.c')
-rw-r--r-- | src/rps/gnunet-service-rps.c | 99 |
1 files changed, 50 insertions, 49 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index f20f49492..389c6139b 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c | |||
@@ -168,7 +168,7 @@ struct ChannelCtx; | |||
168 | * This is stored in a multipeermap. | 168 | * This is stored in a multipeermap. |
169 | * It contains information such as cadet channels, a message queue for sending, | 169 | * It contains information such as cadet channels, a message queue for sending, |
170 | * status about the channels, the pending operations on this peer and some flags | 170 | * status about the channels, the pending operations on this peer and some flags |
171 | * about the status of the peer itself. (live, valid, ...) | 171 | * about the status of the peer itself. (online, valid, ...) |
172 | */ | 172 | */ |
173 | struct PeerContext | 173 | struct PeerContext |
174 | { | 174 | { |
@@ -197,7 +197,7 @@ struct PeerContext | |||
197 | * | 197 | * |
198 | * To be canceled on shutdown. | 198 | * To be canceled on shutdown. |
199 | */ | 199 | */ |
200 | struct PendingMessage *liveliness_check_pending; | 200 | struct PendingMessage *online_check_pending; |
201 | 201 | ||
202 | /** | 202 | /** |
203 | * Number of pending operations. | 203 | * Number of pending operations. |
@@ -794,51 +794,51 @@ remove_pending_message (struct PendingMessage *pending_msg, int cancel) | |||
794 | 794 | ||
795 | /** | 795 | /** |
796 | * @brief This is called in response to the first message we sent as a | 796 | * @brief This is called in response to the first message we sent as a |
797 | * liveliness check. | 797 | * online check. |
798 | * | 798 | * |
799 | * @param cls #PeerContext of peer with pending liveliness check | 799 | * @param cls #PeerContext of peer with pending online check |
800 | */ | 800 | */ |
801 | static void | 801 | static void |
802 | mq_liveliness_check_successful (void *cls) | 802 | mq_online_check_successful (void *cls) |
803 | { | 803 | { |
804 | struct PeerContext *peer_ctx = cls; | 804 | struct PeerContext *peer_ctx = cls; |
805 | 805 | ||
806 | if (NULL != peer_ctx->liveliness_check_pending) | 806 | if (NULL != peer_ctx->online_check_pending) |
807 | { | 807 | { |
808 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 808 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
809 | "Liveliness check for peer %s was successfull\n", | 809 | "Online check for peer %s was successfull\n", |
810 | GNUNET_i2s (&peer_ctx->peer_id)); | 810 | GNUNET_i2s (&peer_ctx->peer_id)); |
811 | remove_pending_message (peer_ctx->liveliness_check_pending, GNUNET_YES); | 811 | remove_pending_message (peer_ctx->online_check_pending, GNUNET_YES); |
812 | peer_ctx->liveliness_check_pending = NULL; | 812 | peer_ctx->online_check_pending = NULL; |
813 | set_peer_live (peer_ctx); | 813 | set_peer_online (peer_ctx); |
814 | } | 814 | } |
815 | } | 815 | } |
816 | 816 | ||
817 | /** | 817 | /** |
818 | * Issue a check whether peer is live | 818 | * Issue a check whether peer is online |
819 | * | 819 | * |
820 | * @param peer_ctx the context of the peer | 820 | * @param peer_ctx the context of the peer |
821 | */ | 821 | */ |
822 | static void | 822 | static void |
823 | check_peer_live (struct PeerContext *peer_ctx) | 823 | check_peer_online (struct PeerContext *peer_ctx) |
824 | { | 824 | { |
825 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 825 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
826 | "Get informed about peer %s getting live\n", | 826 | "Get informed about peer %s getting online\n", |
827 | GNUNET_i2s (&peer_ctx->peer_id)); | 827 | GNUNET_i2s (&peer_ctx->peer_id)); |
828 | 828 | ||
829 | struct GNUNET_MQ_Handle *mq; | 829 | struct GNUNET_MQ_Handle *mq; |
830 | struct GNUNET_MQ_Envelope *ev; | 830 | struct GNUNET_MQ_Envelope *ev; |
831 | 831 | ||
832 | ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_RPS_PP_CHECK_LIVE); | 832 | ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_RPS_PP_CHECK_LIVE); |
833 | peer_ctx->liveliness_check_pending = | 833 | peer_ctx->online_check_pending = |
834 | insert_pending_message (&peer_ctx->peer_id, ev, "Check liveliness"); | 834 | insert_pending_message (&peer_ctx->peer_id, ev, "Check online"); |
835 | mq = get_mq (&peer_ctx->peer_id); | 835 | mq = get_mq (&peer_ctx->peer_id); |
836 | GNUNET_MQ_notify_sent (ev, | 836 | GNUNET_MQ_notify_sent (ev, |
837 | mq_liveliness_check_successful, | 837 | mq_online_check_successful, |
838 | peer_ctx); | 838 | peer_ctx); |
839 | GNUNET_MQ_send (mq, ev); | 839 | GNUNET_MQ_send (mq, ev); |
840 | GNUNET_STATISTICS_update (stats, | 840 | GNUNET_STATISTICS_update (stats, |
841 | "# pending liveliness checks", | 841 | "# pending online checks", |
842 | 1, | 842 | 1, |
843 | GNUNET_NO); | 843 | GNUNET_NO); |
844 | } | 844 | } |
@@ -971,14 +971,14 @@ destroy_peer (struct PeerContext *peer_ctx) | |||
971 | "Removing unsent %s\n", | 971 | "Removing unsent %s\n", |
972 | peer_ctx->pending_messages_head->type); | 972 | peer_ctx->pending_messages_head->type); |
973 | /* Cancle pending message, too */ | 973 | /* Cancle pending message, too */ |
974 | if ( (NULL != peer_ctx->liveliness_check_pending) && | 974 | if ( (NULL != peer_ctx->online_check_pending) && |
975 | (0 == memcmp (peer_ctx->pending_messages_head, | 975 | (0 == memcmp (peer_ctx->pending_messages_head, |
976 | peer_ctx->liveliness_check_pending, | 976 | peer_ctx->online_check_pending, |
977 | sizeof (struct PendingMessage))) ) | 977 | sizeof (struct PendingMessage))) ) |
978 | { | 978 | { |
979 | peer_ctx->liveliness_check_pending = NULL; | 979 | peer_ctx->online_check_pending = NULL; |
980 | GNUNET_STATISTICS_update (stats, | 980 | GNUNET_STATISTICS_update (stats, |
981 | "# pending liveliness checks", | 981 | "# pending online checks", |
982 | -1, | 982 | -1, |
983 | GNUNET_NO); | 983 | GNUNET_NO); |
984 | } | 984 | } |
@@ -986,18 +986,18 @@ destroy_peer (struct PeerContext *peer_ctx) | |||
986 | GNUNET_YES); | 986 | GNUNET_YES); |
987 | } | 987 | } |
988 | 988 | ||
989 | /* If we are still waiting for notification whether this peer is live | 989 | /* If we are still waiting for notification whether this peer is online |
990 | * cancel the according task */ | 990 | * cancel the according task */ |
991 | if (NULL != peer_ctx->liveliness_check_pending) | 991 | if (NULL != peer_ctx->online_check_pending) |
992 | { | 992 | { |
993 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 993 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
994 | "Removing pending liveliness check for peer %s\n", | 994 | "Removing pending online check for peer %s\n", |
995 | GNUNET_i2s (&peer_ctx->peer_id)); | 995 | GNUNET_i2s (&peer_ctx->peer_id)); |
996 | // TODO wait until cadet sets mq->cancel_impl | 996 | // TODO wait until cadet sets mq->cancel_impl |
997 | //GNUNET_MQ_send_cancel (peer_ctx->liveliness_check_pending->ev); | 997 | //GNUNET_MQ_send_cancel (peer_ctx->online_check_pending->ev); |
998 | remove_pending_message (peer_ctx->liveliness_check_pending, | 998 | remove_pending_message (peer_ctx->online_check_pending, |
999 | GNUNET_YES); | 999 | GNUNET_YES); |
1000 | peer_ctx->liveliness_check_pending = NULL; | 1000 | peer_ctx->online_check_pending = NULL; |
1001 | } | 1001 | } |
1002 | 1002 | ||
1003 | if (NULL != peer_ctx->send_channel_ctx) | 1003 | if (NULL != peer_ctx->send_channel_ctx) |
@@ -1430,21 +1430,21 @@ check_peer_flag (const struct GNUNET_PeerIdentity *peer, | |||
1430 | * | 1430 | * |
1431 | * If not known yet, insert into known peers | 1431 | * If not known yet, insert into known peers |
1432 | * | 1432 | * |
1433 | * @param peer the peer whose liveliness is to be checked | 1433 | * @param peer the peer whose online is to be checked |
1434 | * @return #GNUNET_YES if the check was issued | 1434 | * @return #GNUNET_YES if the check was issued |
1435 | * #GNUNET_NO otherwise | 1435 | * #GNUNET_NO otherwise |
1436 | */ | 1436 | */ |
1437 | static int | 1437 | static int |
1438 | issue_peer_liveliness_check (const struct GNUNET_PeerIdentity *peer) | 1438 | issue_peer_online_check (const struct GNUNET_PeerIdentity *peer) |
1439 | { | 1439 | { |
1440 | struct PeerContext *peer_ctx; | 1440 | struct PeerContext *peer_ctx; |
1441 | 1441 | ||
1442 | (void) insert_peer (peer); | 1442 | (void) insert_peer (peer); |
1443 | peer_ctx = get_peer_ctx (peer); | 1443 | peer_ctx = get_peer_ctx (peer); |
1444 | if ( (GNUNET_NO == check_peer_flag (peer, Peers_ONLINE)) && | 1444 | if ( (GNUNET_NO == check_peer_flag (peer, Peers_ONLINE)) && |
1445 | (NULL == peer_ctx->liveliness_check_pending) ) | 1445 | (NULL == peer_ctx->online_check_pending) ) |
1446 | { | 1446 | { |
1447 | check_peer_live (peer_ctx); | 1447 | check_peer_online (peer_ctx); |
1448 | return GNUNET_YES; | 1448 | return GNUNET_YES; |
1449 | } | 1449 | } |
1450 | return GNUNET_NO; | 1450 | return GNUNET_NO; |
@@ -1566,7 +1566,7 @@ handle_inbound_channel (void *cls, | |||
1566 | GNUNET_assert (NULL != channel); /* according to cadet API */ | 1566 | GNUNET_assert (NULL != channel); /* according to cadet API */ |
1567 | /* Make sure we 'know' about this peer */ | 1567 | /* Make sure we 'know' about this peer */ |
1568 | peer_ctx = create_or_get_peer_ctx (initiator); | 1568 | peer_ctx = create_or_get_peer_ctx (initiator); |
1569 | set_peer_live (peer_ctx); | 1569 | set_peer_online (peer_ctx); |
1570 | ctx_peer = GNUNET_new (struct GNUNET_PeerIdentity); | 1570 | ctx_peer = GNUNET_new (struct GNUNET_PeerIdentity); |
1571 | *ctx_peer = *initiator; | 1571 | *ctx_peer = *initiator; |
1572 | channel_ctx = add_channel_ctx (peer_ctx); | 1572 | channel_ctx = add_channel_ctx (peer_ctx); |
@@ -1675,7 +1675,8 @@ send_message (const struct GNUNET_PeerIdentity *peer, | |||
1675 | * | 1675 | * |
1676 | * Avoids scheduling an operation twice. | 1676 | * Avoids scheduling an operation twice. |
1677 | * | 1677 | * |
1678 | * @param peer the peer we want to schedule the operation for once it gets live | 1678 | * @param peer the peer we want to schedule the operation for once it gets |
1679 | * online | ||
1679 | * | 1680 | * |
1680 | * @return #GNUNET_YES if the operation was scheduled | 1681 | * @return #GNUNET_YES if the operation was scheduled |
1681 | * #GNUNET_NO otherwise | 1682 | * #GNUNET_NO otherwise |
@@ -1689,7 +1690,7 @@ schedule_operation (const struct GNUNET_PeerIdentity *peer, | |||
1689 | 1690 | ||
1690 | GNUNET_assert (GNUNET_YES == check_peer_known (peer)); | 1691 | GNUNET_assert (GNUNET_YES == check_peer_known (peer)); |
1691 | 1692 | ||
1692 | //TODO if LIVE/ONLINE execute immediately | 1693 | //TODO if ONLINE execute immediately |
1693 | 1694 | ||
1694 | if (GNUNET_NO == check_operation_scheduled (peer, peer_op)) | 1695 | if (GNUNET_NO == check_operation_scheduled (peer, peer_op)) |
1695 | { | 1696 | { |
@@ -2061,7 +2062,7 @@ rem_from_list (struct GNUNET_PeerIdentity **peer_list, | |||
2061 | /** | 2062 | /** |
2062 | * Insert PeerID in #view | 2063 | * Insert PeerID in #view |
2063 | * | 2064 | * |
2064 | * Called once we know a peer is live. | 2065 | * Called once we know a peer is online. |
2065 | * Implements #PeerOp | 2066 | * Implements #PeerOp |
2066 | * | 2067 | * |
2067 | * @return GNUNET_OK if peer was actually inserted | 2068 | * @return GNUNET_OK if peer was actually inserted |
@@ -2074,7 +2075,7 @@ insert_in_view_op (void *cls, | |||
2074 | /** | 2075 | /** |
2075 | * Insert PeerID in #view | 2076 | * Insert PeerID in #view |
2076 | * | 2077 | * |
2077 | * Called once we know a peer is live. | 2078 | * Called once we know a peer is online. |
2078 | * | 2079 | * |
2079 | * @return GNUNET_OK if peer was actually inserted | 2080 | * @return GNUNET_OK if peer was actually inserted |
2080 | * GNUNET_NO if peer was not inserted | 2081 | * GNUNET_NO if peer was not inserted |
@@ -2089,7 +2090,7 @@ insert_in_view (const struct GNUNET_PeerIdentity *peer) | |||
2089 | if ( (GNUNET_NO == online) || | 2090 | if ( (GNUNET_NO == online) || |
2090 | (GNUNET_SYSERR == online) ) /* peer is not even known */ | 2091 | (GNUNET_SYSERR == online) ) /* peer is not even known */ |
2091 | { | 2092 | { |
2092 | (void) issue_peer_liveliness_check (peer); | 2093 | (void) issue_peer_online_check (peer); |
2093 | (void) schedule_operation (peer, insert_in_view_op); | 2094 | (void) schedule_operation (peer, insert_in_view_op); |
2094 | return GNUNET_NO; | 2095 | return GNUNET_NO; |
2095 | } | 2096 | } |
@@ -2376,21 +2377,21 @@ send_pull_reply (const struct GNUNET_PeerIdentity *peer_id, | |||
2376 | /** | 2377 | /** |
2377 | * Insert PeerID in #pull_map | 2378 | * Insert PeerID in #pull_map |
2378 | * | 2379 | * |
2379 | * Called once we know a peer is live. | 2380 | * Called once we know a peer is online. |
2380 | */ | 2381 | */ |
2381 | static void | 2382 | static void |
2382 | insert_in_pull_map (void *cls, | 2383 | insert_in_pull_map (void *cls, |
2383 | const struct GNUNET_PeerIdentity *peer) | 2384 | const struct GNUNET_PeerIdentity *peer) |
2384 | { | 2385 | { |
2385 | (void) cls; | 2386 | (void) cls; |
2386 | CustomPeerMap_put (pull_map, peer); | 2387 | CustomPeerMap_put (mss->pull_map, peer); |
2387 | } | 2388 | } |
2388 | 2389 | ||
2389 | 2390 | ||
2390 | /** | 2391 | /** |
2391 | * Insert PeerID in #view | 2392 | * Insert PeerID in #view |
2392 | * | 2393 | * |
2393 | * Called once we know a peer is live. | 2394 | * Called once we know a peer is online. |
2394 | * Implements #PeerOp | 2395 | * Implements #PeerOp |
2395 | */ | 2396 | */ |
2396 | static void | 2397 | static void |
@@ -2424,7 +2425,7 @@ insert_in_sampler (void *cls, | |||
2424 | if (0 < RPS_sampler_count_id (prot_sampler, peer)) | 2425 | if (0 < RPS_sampler_count_id (prot_sampler, peer)) |
2425 | { | 2426 | { |
2426 | /* Make sure we 'know' about this peer */ | 2427 | /* Make sure we 'know' about this peer */ |
2427 | (void) issue_peer_liveliness_check (peer); | 2428 | (void) issue_peer_online_check (peer); |
2428 | /* Establish a channel towards that peer to indicate we are going to send | 2429 | /* Establish a channel towards that peer to indicate we are going to send |
2429 | * messages to it */ | 2430 | * messages to it */ |
2430 | //indicate_sending_intention (peer); | 2431 | //indicate_sending_intention (peer); |
@@ -2448,7 +2449,7 @@ insert_in_sampler (void *cls, | |||
2448 | 2449 | ||
2449 | /** | 2450 | /** |
2450 | * @brief This is called on peers from external sources (cadet, peerinfo, ...) | 2451 | * @brief This is called on peers from external sources (cadet, peerinfo, ...) |
2451 | * If the peer is not known, liveliness check is issued and it is | 2452 | * If the peer is not known, online check is issued and it is |
2452 | * scheduled to be inserted in sampler and view. | 2453 | * scheduled to be inserted in sampler and view. |
2453 | * | 2454 | * |
2454 | * "External sources" refer to every source except the gossip. | 2455 | * "External sources" refer to every source except the gossip. |
@@ -2459,7 +2460,7 @@ static void | |||
2459 | got_peer (const struct GNUNET_PeerIdentity *peer) | 2460 | got_peer (const struct GNUNET_PeerIdentity *peer) |
2460 | { | 2461 | { |
2461 | /* If we did not know this peer already, insert it into sampler and view */ | 2462 | /* If we did not know this peer already, insert it into sampler and view */ |
2462 | if (GNUNET_YES == issue_peer_liveliness_check (peer)) | 2463 | if (GNUNET_YES == issue_peer_online_check (peer)) |
2463 | { | 2464 | { |
2464 | schedule_operation (peer, insert_in_sampler); | 2465 | schedule_operation (peer, insert_in_sampler); |
2465 | schedule_operation (peer, insert_in_view_op); | 2466 | schedule_operation (peer, insert_in_view_op); |
@@ -2827,7 +2828,7 @@ handle_peer_check (void *cls, | |||
2827 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2828 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2828 | "Received CHECK_LIVE (%s)\n", GNUNET_i2s (peer)); | 2829 | "Received CHECK_LIVE (%s)\n", GNUNET_i2s (peer)); |
2829 | GNUNET_STATISTICS_update (stats, | 2830 | GNUNET_STATISTICS_update (stats, |
2830 | "# pending liveliness checks", | 2831 | "# pending online checks", |
2831 | -1, | 2832 | -1, |
2832 | GNUNET_NO); | 2833 | GNUNET_NO); |
2833 | 2834 | ||
@@ -3061,7 +3062,7 @@ handle_peer_pull_reply (void *cls, | |||
3061 | else | 3062 | else |
3062 | { | 3063 | { |
3063 | schedule_operation (&peers[i], insert_in_pull_map); | 3064 | schedule_operation (&peers[i], insert_in_pull_map); |
3064 | (void) issue_peer_liveliness_check (&peers[i]); | 3065 | (void) issue_peer_online_check (&peers[i]); |
3065 | } | 3066 | } |
3066 | } | 3067 | } |
3067 | 3068 | ||
@@ -3287,7 +3288,7 @@ handle_client_act_malicious (void *cls, | |||
3287 | /* Set the flag of the attacked peer to valid to avoid problems */ | 3288 | /* Set the flag of the attacked peer to valid to avoid problems */ |
3288 | if (GNUNET_NO == check_peer_known (&attacked_peer)) | 3289 | if (GNUNET_NO == check_peer_known (&attacked_peer)) |
3289 | { | 3290 | { |
3290 | (void) issue_peer_liveliness_check (&attacked_peer); | 3291 | (void) issue_peer_online_check (&attacked_peer); |
3291 | } | 3292 | } |
3292 | 3293 | ||
3293 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 3294 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -3378,7 +3379,7 @@ do_mal_round (void *cls) | |||
3378 | * Send as many pushes to the attacked peer as possible | 3379 | * Send as many pushes to the attacked peer as possible |
3379 | * That is one push per round as it will ignore more. | 3380 | * That is one push per round as it will ignore more. |
3380 | */ | 3381 | */ |
3381 | (void) issue_peer_liveliness_check (&attacked_peer); | 3382 | (void) issue_peer_online_check (&attacked_peer); |
3382 | if (GNUNET_YES == check_peer_flag (&attacked_peer, Peers_ONLINE)) | 3383 | if (GNUNET_YES == check_peer_flag (&attacked_peer, Peers_ONLINE)) |
3383 | send_push (&attacked_peer); | 3384 | send_push (&attacked_peer); |
3384 | } | 3385 | } |
@@ -3390,7 +3391,7 @@ do_mal_round (void *cls) | |||
3390 | /* Send PUSH to attacked peers */ | 3391 | /* Send PUSH to attacked peers */ |
3391 | if (GNUNET_YES == check_peer_known (&attacked_peer)) | 3392 | if (GNUNET_YES == check_peer_known (&attacked_peer)) |
3392 | { | 3393 | { |
3393 | (void) issue_peer_liveliness_check (&attacked_peer); | 3394 | (void) issue_peer_online_check (&attacked_peer); |
3394 | if (GNUNET_YES == check_peer_flag (&attacked_peer, Peers_ONLINE)) | 3395 | if (GNUNET_YES == check_peer_flag (&attacked_peer, Peers_ONLINE)) |
3395 | { | 3396 | { |
3396 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 3397 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -3399,7 +3400,7 @@ do_mal_round (void *cls) | |||
3399 | send_push (&attacked_peer); | 3400 | send_push (&attacked_peer); |
3400 | } | 3401 | } |
3401 | } | 3402 | } |
3402 | (void) issue_peer_liveliness_check (&attacked_peer); | 3403 | (void) issue_peer_online_check (&attacked_peer); |
3403 | 3404 | ||
3404 | /* The maximum of pushes we're going to send this round */ | 3405 | /* The maximum of pushes we're going to send this round */ |
3405 | num_pushes = GNUNET_MIN (GNUNET_MIN (push_limit - 1, | 3406 | num_pushes = GNUNET_MIN (GNUNET_MIN (push_limit - 1, |