diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2015-07-31 11:18:03 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2015-07-31 11:18:03 +0000 |
commit | 957a3ee819dd1f168ec0103f92764845ed109b78 (patch) | |
tree | 83c90f94b5b9d33103a5a9bedf6da54887b7d83f /src/rps | |
parent | 1e8d3f1f3889f780c3b4eac7ba434bc76ce757ed (diff) | |
download | gnunet-957a3ee819dd1f168ec0103f92764845ed109b78.tar.gz gnunet-957a3ee819dd1f168ec0103f92764845ed109b78.zip |
fixes
Diffstat (limited to 'src/rps')
-rw-r--r-- | src/rps/gnunet-service-rps.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index 84b46ef2e..3c98d79da 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c | |||
@@ -1355,6 +1355,8 @@ handle_client_request (void *cls, | |||
1355 | 1355 | ||
1356 | if (GNUNET_SERVER_MAX_MESSAGE_SIZE < size_needed) | 1356 | if (GNUNET_SERVER_MAX_MESSAGE_SIZE < size_needed) |
1357 | { | 1357 | { |
1358 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1359 | "Message received from client has size larger than expected\n"); | ||
1358 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 1360 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
1359 | return; | 1361 | return; |
1360 | } | 1362 | } |
@@ -1506,8 +1508,7 @@ handle_peer_push (void *cls, | |||
1506 | /* Add the sending peer to the push_list */ | 1508 | /* Add the sending peer to the push_list */ |
1507 | if (GNUNET_NO == in_arr (push_list, push_list_size, peer)) | 1509 | if (GNUNET_NO == in_arr (push_list, push_list_size, peer)) |
1508 | { | 1510 | { |
1509 | if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (peer_map, peer)) | 1511 | GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (peer_map, peer)); |
1510 | (void) create_peer_ctx (peer); | ||
1511 | GNUNET_array_append (push_list, push_list_size, *peer); | 1512 | GNUNET_array_append (push_list, push_list_size, *peer); |
1512 | } | 1513 | } |
1513 | 1514 | ||
@@ -1654,6 +1655,7 @@ handle_peer_pull_reply (void *cls, | |||
1654 | if (sizeof (struct GNUNET_RPS_P2P_PullReplyMessage) > ntohs (msg->size)) | 1655 | if (sizeof (struct GNUNET_RPS_P2P_PullReplyMessage) > ntohs (msg->size)) |
1655 | { | 1656 | { |
1656 | GNUNET_break_op (0); | 1657 | GNUNET_break_op (0); |
1658 | GNUNET_CADET_receive_done (channel); | ||
1657 | return GNUNET_SYSERR; | 1659 | return GNUNET_SYSERR; |
1658 | } | 1660 | } |
1659 | 1661 | ||
@@ -1667,6 +1669,7 @@ handle_peer_pull_reply (void *cls, | |||
1667 | (ntohs (msg->size) - sizeof (struct GNUNET_RPS_P2P_PullReplyMessage)) / | 1669 | (ntohs (msg->size) - sizeof (struct GNUNET_RPS_P2P_PullReplyMessage)) / |
1668 | sizeof (struct GNUNET_PeerIdentity)); | 1670 | sizeof (struct GNUNET_PeerIdentity)); |
1669 | GNUNET_break_op (0); | 1671 | GNUNET_break_op (0); |
1672 | GNUNET_CADET_receive_done (channel); | ||
1670 | return GNUNET_SYSERR; | 1673 | return GNUNET_SYSERR; |
1671 | } | 1674 | } |
1672 | 1675 | ||
@@ -1683,6 +1686,7 @@ handle_peer_pull_reply (void *cls, | |||
1683 | LOG (GNUNET_ERROR_TYPE_WARNING, | 1686 | LOG (GNUNET_ERROR_TYPE_WARNING, |
1684 | "Received a pull reply from a peer we didn't request one from!\n"); | 1687 | "Received a pull reply from a peer we didn't request one from!\n"); |
1685 | GNUNET_break_op (0); | 1688 | GNUNET_break_op (0); |
1689 | GNUNET_CADET_receive_done (channel); | ||
1686 | return GNUNET_OK; | 1690 | return GNUNET_OK; |
1687 | } | 1691 | } |
1688 | 1692 | ||
@@ -1708,8 +1712,8 @@ handle_peer_pull_reply (void *cls, | |||
1708 | GNUNET_i2s (&peers[i])); | 1712 | GNUNET_i2s (&peers[i])); |
1709 | 1713 | ||
1710 | #ifdef ENABLE_MALICIOUS | 1714 | #ifdef ENABLE_MALICIOUS |
1711 | if (1 == mal_type | 1715 | if ((NULL != att_peer_set) && |
1712 | || 3 == mal_type) | 1716 | (1 == mal_type || 3 == mal_type)) |
1713 | { /* Add attacked peer to local list */ | 1717 | { /* Add attacked peer to local list */ |
1714 | // TODO check if we sent a request and this was the first reply | 1718 | // TODO check if we sent a request and this was the first reply |
1715 | if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (att_peer_set, | 1719 | if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (att_peer_set, |
@@ -2010,7 +2014,7 @@ do_mal_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
2010 | 2014 | ||
2011 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Going to execute next round maliciously type %" PRIu32 ".\n", | 2015 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Going to execute next round maliciously type %" PRIu32 ".\n", |
2012 | mal_type); | 2016 | mal_type); |
2013 | 2017 | do_round_task = NULL; | |
2014 | GNUNET_assert (mal_type <= 3); | 2018 | GNUNET_assert (mal_type <= 3); |
2015 | /* Do malicious actions */ | 2019 | /* Do malicious actions */ |
2016 | if (1 == mal_type) | 2020 | if (1 == mal_type) |
@@ -2112,7 +2116,9 @@ do_mal_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
2112 | /* Schedule next round */ | 2116 | /* Schedule next round */ |
2113 | time_next_round = compute_rand_delay (round_interval, 2); | 2117 | time_next_round = compute_rand_delay (round_interval, 2); |
2114 | 2118 | ||
2115 | //do_round_task = GNUNET_SCHEDULER_add_delayed (round_interval, &do_mal_round, NULL); | 2119 | //do_round_task = GNUNET_SCHEDULER_add_delayed (round_interval, &do_mal_round, |
2120 | //NULL); | ||
2121 | GNUNET_assert (NULL == do_round_task); | ||
2116 | do_round_task = GNUNET_SCHEDULER_add_delayed (time_next_round, &do_mal_round, NULL); | 2122 | do_round_task = GNUNET_SCHEDULER_add_delayed (time_next_round, &do_mal_round, NULL); |
2117 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Finished round\n"); | 2123 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Finished round\n"); |
2118 | } | 2124 | } |
@@ -2139,6 +2145,7 @@ do_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
2139 | struct GNUNET_PeerIdentity peer; | 2145 | struct GNUNET_PeerIdentity peer; |
2140 | struct PeerContext *peer_ctx; | 2146 | struct PeerContext *peer_ctx; |
2141 | 2147 | ||
2148 | do_round_task = NULL; | ||
2142 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2149 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2143 | "Printing view:\n"); | 2150 | "Printing view:\n"); |
2144 | to_file (file_name_view_log, | 2151 | to_file (file_name_view_log, |