diff options
author | Julius Bünger <buenger@mytum.de> | 2015-08-05 17:46:18 +0000 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2015-08-05 17:46:18 +0000 |
commit | 92570078231bdd7401d79a7cb5e4438110ff3109 (patch) | |
tree | 3a7b5ec8bcbcb18431561a83c062355c96734df5 /src/rps | |
parent | 7057c218dc0e04b4eb073a67b6c9ed3048f46123 (diff) | |
download | gnunet-92570078231bdd7401d79a7cb5e4438110ff3109.tar.gz gnunet-92570078231bdd7401d79a7cb5e4438110ff3109.zip |
-logging messages: going to send, sent, received
Diffstat (limited to 'src/rps')
-rw-r--r-- | src/rps/gnunet-service-rps.c | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index 242ee5a4c..ef9cf4a1b 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c | |||
@@ -1148,6 +1148,21 @@ add_peer_array_to_set (const struct GNUNET_PeerIdentity *peer_array, | |||
1148 | 1148 | ||
1149 | 1149 | ||
1150 | /** | 1150 | /** |
1151 | * @brief This is called once a message is sent. | ||
1152 | * | ||
1153 | * @param cls type of the message that was sent | ||
1154 | */ | ||
1155 | static void | ||
1156 | ntfy_callback (void *cls) | ||
1157 | { | ||
1158 | char *type = (char *) cls; | ||
1159 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1160 | "%s was sent.\n", | ||
1161 | type); | ||
1162 | } | ||
1163 | |||
1164 | |||
1165 | /** | ||
1151 | * Send a PULL REPLY to @a peer_id | 1166 | * Send a PULL REPLY to @a peer_id |
1152 | * | 1167 | * |
1153 | * @param peer_id the peer to send the reply to. | 1168 | * @param peer_id the peer to send the reply to. |
@@ -1181,8 +1196,8 @@ send_pull_reply (const struct GNUNET_PeerIdentity *peer_id, | |||
1181 | send_size = num_peer_ids; | 1196 | send_size = num_peer_ids; |
1182 | 1197 | ||
1183 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1198 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1184 | "PULL REQUEST from peer %s received, going to send %u peers\n", | 1199 | "Going to send PULL REPLY with %u peers to %s\n", |
1185 | GNUNET_i2s (peer_id), send_size); | 1200 | send_size, GNUNET_i2s (peer_id)); |
1186 | 1201 | ||
1187 | mq = get_mq (peer_id); | 1202 | mq = get_mq (peer_id); |
1188 | 1203 | ||
@@ -1193,6 +1208,9 @@ send_pull_reply (const struct GNUNET_PeerIdentity *peer_id, | |||
1193 | memcpy (&out_msg[1], peer_ids, | 1208 | memcpy (&out_msg[1], peer_ids, |
1194 | send_size * sizeof (struct GNUNET_PeerIdentity)); | 1209 | send_size * sizeof (struct GNUNET_PeerIdentity)); |
1195 | 1210 | ||
1211 | GNUNET_MQ_notify_sent (ev, | ||
1212 | ntfy_callback, | ||
1213 | "PULL REPLY"); | ||
1196 | GNUNET_MQ_send (mq, ev); | 1214 | GNUNET_MQ_send (mq, ev); |
1197 | } | 1215 | } |
1198 | 1216 | ||
@@ -1555,7 +1573,7 @@ handle_peer_push (void *cls, | |||
1555 | GNUNET_CADET_channel_get_info (channel, GNUNET_CADET_OPTION_PEER); | 1573 | GNUNET_CADET_channel_get_info (channel, GNUNET_CADET_OPTION_PEER); |
1556 | // FIXME wait for cadet to change this function | 1574 | // FIXME wait for cadet to change this function |
1557 | 1575 | ||
1558 | LOG (GNUNET_ERROR_TYPE_DEBUG, "PUSH received (%s)\n", GNUNET_i2s (peer)); | 1576 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Received PUSH (%s)\n", GNUNET_i2s (peer)); |
1559 | 1577 | ||
1560 | #ifdef ENABLE_MALICIOUS | 1578 | #ifdef ENABLE_MALICIOUS |
1561 | struct AttackedPeer *tmp_att_peer; | 1579 | struct AttackedPeer *tmp_att_peer; |
@@ -1678,7 +1696,7 @@ handle_peer_pull_request (void *cls, | |||
1678 | GNUNET_CADET_OPTION_PEER); | 1696 | GNUNET_CADET_OPTION_PEER); |
1679 | // FIXME wait for cadet to change this function | 1697 | // FIXME wait for cadet to change this function |
1680 | 1698 | ||
1681 | LOG (GNUNET_ERROR_TYPE_DEBUG, "PULL REQUEST received (%s)\n", GNUNET_i2s (peer)); | 1699 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Received PULL REQUEST (%s)\n", GNUNET_i2s (peer)); |
1682 | 1700 | ||
1683 | #ifdef ENABLE_MALICIOUS | 1701 | #ifdef ENABLE_MALICIOUS |
1684 | if (1 == mal_type | 1702 | if (1 == mal_type |
@@ -1764,7 +1782,7 @@ handle_peer_pull_reply (void *cls, | |||
1764 | GNUNET_CADET_channel_get_info (channel, GNUNET_CADET_OPTION_PEER); | 1782 | GNUNET_CADET_channel_get_info (channel, GNUNET_CADET_OPTION_PEER); |
1765 | sender_ctx = get_peer_ctx (sender); | 1783 | sender_ctx = get_peer_ctx (sender); |
1766 | 1784 | ||
1767 | LOG (GNUNET_ERROR_TYPE_DEBUG, "PULL REPLY received (%s)\n", GNUNET_i2s (sender)); | 1785 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Received PULL REPLY (%s)\n", GNUNET_i2s (sender)); |
1768 | 1786 | ||
1769 | if (GNUNET_YES != get_peer_flag (sender_ctx, PULL_REPLY_PENDING)) | 1787 | if (GNUNET_YES != get_peer_flag (sender_ctx, PULL_REPLY_PENDING)) |
1770 | { | 1788 | { |
@@ -1916,11 +1934,14 @@ send_pull_request (struct GNUNET_PeerIdentity *peer_id) | |||
1916 | set_peer_flag (peer_ctx, PULL_REPLY_PENDING); | 1934 | set_peer_flag (peer_ctx, PULL_REPLY_PENDING); |
1917 | 1935 | ||
1918 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1936 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1919 | "Sending PULL request to peer %s of view.\n", | 1937 | "Going to send PULL REQUEST to peer %s.\n", |
1920 | GNUNET_i2s (peer_id)); | 1938 | GNUNET_i2s (peer_id)); |
1921 | 1939 | ||
1922 | ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_RPS_PP_PULL_REQUEST); | 1940 | ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_RPS_PP_PULL_REQUEST); |
1923 | mq = get_mq (peer_id); | 1941 | mq = get_mq (peer_id); |
1942 | GNUNET_MQ_notify_sent (ev, | ||
1943 | ntfy_callback, | ||
1944 | "PULL REQUEST"); | ||
1924 | GNUNET_MQ_send (mq, ev); | 1945 | GNUNET_MQ_send (mq, ev); |
1925 | } | 1946 | } |
1926 | 1947 | ||
@@ -1937,11 +1958,14 @@ send_push (struct GNUNET_PeerIdentity *peer_id) | |||
1937 | struct GNUNET_MQ_Handle *mq; | 1958 | struct GNUNET_MQ_Handle *mq; |
1938 | 1959 | ||
1939 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1960 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1940 | "Sending PUSH to peer %s of view.\n", | 1961 | "Going to send PUSH to peer %s.\n", |
1941 | GNUNET_i2s (peer_id)); | 1962 | GNUNET_i2s (peer_id)); |
1942 | 1963 | ||
1943 | ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_RPS_PP_PUSH); | 1964 | ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_RPS_PP_PUSH); |
1944 | mq = get_mq (peer_id); | 1965 | mq = get_mq (peer_id); |
1966 | GNUNET_MQ_notify_sent (ev, | ||
1967 | ntfy_callback, | ||
1968 | "PUSH"); | ||
1945 | GNUNET_MQ_send (mq, ev); | 1969 | GNUNET_MQ_send (mq, ev); |
1946 | } | 1970 | } |
1947 | 1971 | ||