diff options
author | Bart Polot <bart@net.in.tum.de> | 2014-06-24 14:44:15 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2014-06-24 14:44:15 +0000 |
commit | 37911ad964e19bc6a839689013b6f11b23e077c1 (patch) | |
tree | 00b9c1f082febd38b43e00c04fe4ea9666ce788a /src | |
parent | ee30203b0b5f8a7b88fe2905e9d6ae62c9cfca8f (diff) | |
download | gnunet-37911ad964e19bc6a839689013b6f11b23e077c1.tar.gz gnunet-37911ad964e19bc6a839689013b6f11b23e077c1.zip |
- check return values from GCC_send_prebuilt_message
Diffstat (limited to 'src')
-rw-r--r-- | src/cadet/gnunet-service-cadet_connection.c | 64 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet_tunnel.c | 11 |
2 files changed, 34 insertions, 41 deletions
diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c index 52fb963cf..00af5351c 100644 --- a/src/cadet/gnunet-service-cadet_connection.c +++ b/src/cadet/gnunet-service-cadet_connection.c | |||
@@ -538,10 +538,10 @@ send_ack (struct CadetConnection *c, unsigned int buffer, int fwd, int force) | |||
538 | msg.ack = htonl (ack); | 538 | msg.ack = htonl (ack); |
539 | msg.cid = c->id; | 539 | msg.cid = c->id; |
540 | 540 | ||
541 | prev_fc->ack_msg = GCC_send_prebuilt_message (&msg.header, | 541 | prev_fc->ack_msg = GCC_send_prebuilt_message (&msg.header, 0, ack, c, |
542 | GNUNET_MESSAGE_TYPE_CADET_ACK, | 542 | !fwd, GNUNET_YES, |
543 | ack, c, !fwd, GNUNET_YES, | ||
544 | &ack_sent, prev_fc); | 543 | &ack_sent, prev_fc); |
544 | GNUNET_assert (NULL != prev_fc->ack_msg); | ||
545 | } | 545 | } |
546 | 546 | ||
547 | 547 | ||
@@ -840,9 +840,8 @@ send_broken (struct CadetConnection *c, | |||
840 | msg.cid = c->id; | 840 | msg.cid = c->id; |
841 | msg.peer1 = *id1; | 841 | msg.peer1 = *id1; |
842 | msg.peer2 = *id2; | 842 | msg.peer2 = *id2; |
843 | GCC_send_prebuilt_message (&msg.header, | 843 | GNUNET_assert (NULL == GCC_send_prebuilt_message (&msg.header, 0, 0, c, fwd, |
844 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, 0, | 844 | GNUNET_YES, NULL, NULL)); |
845 | c, fwd, GNUNET_YES, NULL, NULL); | ||
846 | } | 845 | } |
847 | 846 | ||
848 | 847 | ||
@@ -1234,11 +1233,9 @@ connection_poll (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1234 | msg.pid = htonl (fc->last_pid_sent); | 1233 | msg.pid = htonl (fc->last_pid_sent); |
1235 | LOG (GNUNET_ERROR_TYPE_DEBUG, " *** last pid sent: %u!\n", fc->last_pid_sent); | 1234 | LOG (GNUNET_ERROR_TYPE_DEBUG, " *** last pid sent: %u!\n", fc->last_pid_sent); |
1236 | fc->poll_msg = | 1235 | fc->poll_msg = |
1237 | GCC_send_prebuilt_message (&msg.header, | 1236 | GCC_send_prebuilt_message (&msg.header, 0, fc->last_pid_sent, c, |
1238 | GNUNET_MESSAGE_TYPE_CADET_POLL, | 1237 | fc == &c->fwd_fc, GNUNET_YES, &poll_sent, fc); |
1239 | fc->last_pid_sent, | 1238 | GNUNET_assert (NULL != fc->poll_msg); |
1240 | c, fc == &c->fwd_fc, GNUNET_YES, | ||
1241 | &poll_sent, fc); | ||
1242 | } | 1239 | } |
1243 | 1240 | ||
1244 | 1241 | ||
@@ -1640,10 +1637,9 @@ GCC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1640 | LOG (GNUNET_ERROR_TYPE_DEBUG, " Retransmitting.\n"); | 1637 | LOG (GNUNET_ERROR_TYPE_DEBUG, " Retransmitting.\n"); |
1641 | GCP_add_path (dest_peer, path_duplicate (path), GNUNET_NO); | 1638 | GCP_add_path (dest_peer, path_duplicate (path), GNUNET_NO); |
1642 | GCP_add_path_to_origin (orig_peer, path_duplicate (path), GNUNET_NO); | 1639 | GCP_add_path_to_origin (orig_peer, path_duplicate (path), GNUNET_NO); |
1643 | GCC_send_prebuilt_message (message, | 1640 | GNUNET_assert (NULL == GCC_send_prebuilt_message (message, 0, 0, c, |
1644 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, 0, | 1641 | GNUNET_YES, GNUNET_YES, |
1645 | c, GNUNET_YES, GNUNET_YES, | 1642 | NULL, NULL)); |
1646 | NULL, NULL); | ||
1647 | } | 1643 | } |
1648 | path_destroy (path); | 1644 | path_destroy (path); |
1649 | return GNUNET_OK; | 1645 | return GNUNET_OK; |
@@ -1771,9 +1767,8 @@ GCC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1771 | } | 1767 | } |
1772 | 1768 | ||
1773 | LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n"); | 1769 | LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n"); |
1774 | GCC_send_prebuilt_message (message, | 1770 | GNUNET_assert (NULL == GCC_send_prebuilt_message (message, 0, 0, c, fwd, |
1775 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK, 0, | 1771 | GNUNET_YES, NULL, NULL)); |
1776 | c, fwd, GNUNET_YES, NULL, NULL); | ||
1777 | return GNUNET_OK; | 1772 | return GNUNET_OK; |
1778 | } | 1773 | } |
1779 | 1774 | ||
@@ -1833,9 +1828,8 @@ GCC_handle_broken (void* cls, | |||
1833 | } | 1828 | } |
1834 | else | 1829 | else |
1835 | { | 1830 | { |
1836 | GCC_send_prebuilt_message (message, | 1831 | GNUNET_assert (NULL == GCC_send_prebuilt_message (message, 0, 0, c, fwd, |
1837 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, 0, | 1832 | GNUNET_YES, NULL, NULL)); |
1838 | c, fwd, GNUNET_YES, NULL, NULL); | ||
1839 | c->destroy = GNUNET_YES; | 1833 | c->destroy = GNUNET_YES; |
1840 | connection_cancel_queues (c, !fwd); | 1834 | connection_cancel_queues (c, !fwd); |
1841 | } | 1835 | } |
@@ -1884,9 +1878,8 @@ GCC_handle_destroy (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1884 | return GNUNET_OK; | 1878 | return GNUNET_OK; |
1885 | } | 1879 | } |
1886 | if (GNUNET_NO == GCC_is_terminal (c, fwd)) | 1880 | if (GNUNET_NO == GCC_is_terminal (c, fwd)) |
1887 | GCC_send_prebuilt_message (message, | 1881 | GNUNET_assert (NULL == GCC_send_prebuilt_message (message, 0, 0, c, fwd, |
1888 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, 0, | 1882 | GNUNET_YES, NULL, NULL)); |
1889 | c, fwd, GNUNET_YES, NULL, NULL); | ||
1890 | else if (0 == c->pending_messages) | 1883 | else if (0 == c->pending_messages) |
1891 | { | 1884 | { |
1892 | LOG (GNUNET_ERROR_TYPE_DEBUG, " directly destroying connection!\n"); | 1885 | LOG (GNUNET_ERROR_TYPE_DEBUG, " directly destroying connection!\n"); |
@@ -2030,9 +2023,8 @@ handle_cadet_encrypted (const struct GNUNET_PeerIdentity *peer, | |||
2030 | } | 2023 | } |
2031 | 2024 | ||
2032 | GNUNET_STATISTICS_update (stats, "# messages forwarded", 1, GNUNET_NO); | 2025 | GNUNET_STATISTICS_update (stats, "# messages forwarded", 1, GNUNET_NO); |
2033 | GCC_send_prebuilt_message (&msg->header, | 2026 | GNUNET_assert (NULL == GCC_send_prebuilt_message (&msg->header, 0, 0, c, fwd, |
2034 | GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED, 0, | 2027 | GNUNET_NO, NULL, NULL)); |
2035 | c, fwd, GNUNET_NO, NULL, NULL); | ||
2036 | 2028 | ||
2037 | return GNUNET_OK; | 2029 | return GNUNET_OK; |
2038 | } | 2030 | } |
@@ -2131,8 +2123,8 @@ handle_cadet_kx (const struct GNUNET_PeerIdentity *peer, | |||
2131 | /* Message not for us: forward to next hop */ | 2123 | /* Message not for us: forward to next hop */ |
2132 | LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n"); | 2124 | LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n"); |
2133 | GNUNET_STATISTICS_update (stats, "# messages forwarded", 1, GNUNET_NO); | 2125 | GNUNET_STATISTICS_update (stats, "# messages forwarded", 1, GNUNET_NO); |
2134 | GCC_send_prebuilt_message (&msg->header, GNUNET_MESSAGE_TYPE_CADET_KX, 0, | 2126 | GNUNET_assert (NULL == GCC_send_prebuilt_message (&msg->header, 0, 0, c, fwd, |
2135 | c, fwd, GNUNET_NO, NULL, NULL); | 2127 | GNUNET_NO, NULL, NULL)); |
2136 | 2128 | ||
2137 | return GNUNET_OK; | 2129 | return GNUNET_OK; |
2138 | } | 2130 | } |
@@ -3084,20 +3076,20 @@ GCC_send_destroy (struct CadetConnection *c) | |||
3084 | return; | 3076 | return; |
3085 | 3077 | ||
3086 | msg.header.size = htons (sizeof (msg)); | 3078 | msg.header.size = htons (sizeof (msg)); |
3087 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY);; | 3079 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY); |
3088 | msg.cid = c->id; | 3080 | msg.cid = c->id; |
3089 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 3081 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
3090 | " sending connection destroy for connection %s\n", | 3082 | " sending connection destroy for connection %s\n", |
3091 | GCC_2s (c)); | 3083 | GCC_2s (c)); |
3092 | 3084 | ||
3093 | if (GNUNET_NO == GCC_is_terminal (c, GNUNET_YES)) | 3085 | if (GNUNET_NO == GCC_is_terminal (c, GNUNET_YES)) |
3094 | GCC_send_prebuilt_message (&msg.header, | 3086 | GNUNET_assert (NULL == GCC_send_prebuilt_message (&msg.header, 0, 0, c, |
3095 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, 0, | 3087 | GNUNET_YES, GNUNET_YES, |
3096 | c, GNUNET_YES, GNUNET_YES, NULL, NULL); | 3088 | NULL, NULL)); |
3097 | if (GNUNET_NO == GCC_is_terminal (c, GNUNET_NO)) | 3089 | if (GNUNET_NO == GCC_is_terminal (c, GNUNET_NO)) |
3098 | GCC_send_prebuilt_message (&msg.header, | 3090 | GNUNET_assert (NULL == GCC_send_prebuilt_message (&msg.header, 0, 0, c, |
3099 | GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, 0, | 3091 | GNUNET_NO, GNUNET_YES, |
3100 | c, GNUNET_NO, GNUNET_YES, NULL, NULL); | 3092 | NULL, NULL)); |
3101 | c->destroy = GNUNET_YES; | 3093 | c->destroy = GNUNET_YES; |
3102 | c->state = CADET_CONNECTION_DESTROYED; | 3094 | c->state = CADET_CONNECTION_DESTROYED; |
3103 | } | 3095 | } |
diff --git a/src/cadet/gnunet-service-cadet_tunnel.c b/src/cadet/gnunet-service-cadet_tunnel.c index fb144c441..9106cb83f 100644 --- a/src/cadet/gnunet-service-cadet_tunnel.c +++ b/src/cadet/gnunet-service-cadet_tunnel.c | |||
@@ -1107,9 +1107,8 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
1107 | 1107 | ||
1108 | if (NULL == cont) | 1108 | if (NULL == cont) |
1109 | { | 1109 | { |
1110 | GNUNET_break (NULL == | 1110 | GNUNET_break (NULL == GCC_send_prebuilt_message (&msg->header, type, mid, c, |
1111 | GCC_send_prebuilt_message (&msg->header, type, mid, | 1111 | fwd, force, NULL, NULL)); |
1112 | c, fwd, force, NULL, NULL)); | ||
1113 | return NULL; | 1112 | return NULL; |
1114 | } | 1113 | } |
1115 | if (NULL == existing_q) | 1114 | if (NULL == existing_q) |
@@ -1123,6 +1122,7 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
1123 | } | 1122 | } |
1124 | tq->cq = GCC_send_prebuilt_message (&msg->header, type, mid, c, fwd, force, | 1123 | tq->cq = GCC_send_prebuilt_message (&msg->header, type, mid, c, fwd, force, |
1125 | &tun_message_sent, tq); | 1124 | &tun_message_sent, tq); |
1125 | GNUNET_assert (NULL != tq->cq); | ||
1126 | tq->cont = cont; | 1126 | tq->cont = cont; |
1127 | tq->cont_cls = cont_cls; | 1127 | tq->cont_cls = cont_cls; |
1128 | 1128 | ||
@@ -1248,8 +1248,9 @@ send_kx (struct CadetTunnel *t, | |||
1248 | 1248 | ||
1249 | fwd = GCC_is_origin (t->connection_head->c, GNUNET_YES); | 1249 | fwd = GCC_is_origin (t->connection_head->c, GNUNET_YES); |
1250 | /* TODO save handle and cancel in case of a unneeded retransmission */ | 1250 | /* TODO save handle and cancel in case of a unneeded retransmission */ |
1251 | GCC_send_prebuilt_message (&msg->header, GNUNET_MESSAGE_TYPE_CADET_KX, | 1251 | GNUNET_assert (NULL == GCC_send_prebuilt_message (&msg->header, type, 0, c, |
1252 | message->type, c, fwd, GNUNET_YES, NULL, NULL); | 1252 | fwd, GNUNET_YES, |
1253 | NULL, NULL)); | ||
1253 | } | 1254 | } |
1254 | 1255 | ||
1255 | 1256 | ||