aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/gnunet-service-transport.c')
-rw-r--r--src/transport/gnunet-service-transport.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index bd0f33232..81945c511 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -24,8 +24,7 @@
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 * 25 *
26 * TODO: 26 * TODO:
27 * - if we do not receive an ACK in response to our 27 * - remove AddressValidations, incorporate them into the PeerAddressLists
28 * HELLO, retransmit HELLO!
29 */ 28 */
30#include "platform.h" 29#include "platform.h"
31#include "gnunet_client_lib.h" 30#include "gnunet_client_lib.h"
@@ -307,7 +306,12 @@ struct MessageQueue
307 /** 306 /**
308 * Neighbor this entry belongs to. 307 * Neighbor this entry belongs to.
309 */ 308 */
310 struct NeighborList *neighbor; 309 /*struct NeighborList *neighbor;*/
310
311 /**
312 * Peer ID of the Neighbor this entry belongs to.
313 */
314 struct GNUNET_PeerIdentity *neighbor_id;
311 315
312 /** 316 /**
313 * Plugin that we used for the transmission. 317 * Plugin that we used for the transmission.
@@ -1060,16 +1064,14 @@ transmit_send_continuation (void *cls,
1060 struct NeighborList *n; 1064 struct NeighborList *n;
1061 1065
1062 GNUNET_assert (mq != NULL); 1066 GNUNET_assert (mq != NULL);
1063 n = mq->neighbor; 1067 n = find_neighbor(mq->neighbor_id);
1064 GNUNET_assert (n != NULL); 1068 if (n == NULL) /* Neighbor must have been removed asynchronously! */
1069 return;
1070
1071 /* Otherwise, let's make sure we've got the right peer */
1065 GNUNET_assert (0 == 1072 GNUNET_assert (0 ==
1066 memcmp (&n->id, target, 1073 memcmp (&n->id, target,
1067 sizeof (struct GNUNET_PeerIdentity))); 1074 sizeof (struct GNUNET_PeerIdentity)));
1068/* rl = n->plugins;
1069 while ((rl != NULL) && (rl->plugin != mq->plugin))
1070 rl = rl->next;
1071 GNUNET_assert (rl != NULL);
1072*/
1073 1075
1074 if (result == GNUNET_OK) 1076 if (result == GNUNET_OK)
1075 { 1077 {
@@ -1221,7 +1223,7 @@ try_transmission_to_peer (struct NeighborList *neighbor)
1221#endif 1223#endif
1222 1224
1223 return rl->plugin->api->send (rl->plugin->api->cls, 1225 return rl->plugin->api->send (rl->plugin->api->cls,
1224 &neighbor->id, 1226 mq->neighbor_id,
1225 mq->message_buf, 1227 mq->message_buf,
1226 mq->message_buf_size, 1228 mq->message_buf_size,
1227 mq->priority, 1229 mq->priority,
@@ -1280,7 +1282,9 @@ transmit_to_peer (struct TransportClient *client,
1280 memcpy (m, message_buf, message_buf_size); 1282 memcpy (m, message_buf, message_buf_size);
1281 mq->message_buf = m; 1283 mq->message_buf = m;
1282 mq->message_buf_size = message_buf_size; 1284 mq->message_buf_size = message_buf_size;
1283 mq->neighbor = neighbor; 1285 mq->neighbor_id = GNUNET_malloc(sizeof (struct GNUNET_PeerIdentity));
1286
1287 memcpy(mq->neighbor_id, &neighbor->id, sizeof(struct GNUNET_PeerIdentity));
1284 mq->internal_msg = is_internal; 1288 mq->internal_msg = is_internal;
1285 mq->priority = priority; 1289 mq->priority = priority;
1286 1290
@@ -1882,6 +1886,7 @@ add_peer_address(struct NeighborList *neighbor, const char *addr, size_t addrlen
1882 1886
1883 GNUNET_assert(addr != NULL); 1887 GNUNET_assert(addr != NULL);
1884 1888
1889 new_address = NULL;
1885 while (head != NULL) 1890 while (head != NULL)
1886 { 1891 {
1887 new_address = GNUNET_malloc(sizeof(struct PeerAddressList)); 1892 new_address = GNUNET_malloc(sizeof(struct PeerAddressList));
@@ -2303,7 +2308,7 @@ disconnect_neighbor (struct NeighborList *current_handle, int check)
2303 while (NULL != (mq = n->messages)) 2308 while (NULL != (mq = n->messages))
2304 { 2309 {
2305 n->messages = mq->next; 2310 n->messages = mq->next;
2306 GNUNET_assert (mq->neighbor == n); 2311 GNUNET_assert (0 == memcmp(mq->neighbor_id, &n->id, sizeof(struct GNUNET_PeerIdentity)));
2307 GNUNET_free (mq); 2312 GNUNET_free (mq);
2308 } 2313 }
2309 if (n->timeout_task != GNUNET_SCHEDULER_NO_TASK) 2314 if (n->timeout_task != GNUNET_SCHEDULER_NO_TASK)