aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/mesh_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesh/mesh_api.c')
-rw-r--r--src/mesh/mesh_api.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/mesh/mesh_api.c b/src/mesh/mesh_api.c
index 2067b7b6c..0f7592056 100644
--- a/src/mesh/mesh_api.c
+++ b/src/mesh/mesh_api.c
@@ -113,7 +113,6 @@ struct peer_list_element
113 /* list of application-types */ 113 /* list of application-types */
114 struct type_list_element *type_head, *type_tail; 114 struct type_list_element *type_head, *type_tail;
115 115
116 struct GNUNET_ATS_Information atsi;
117 struct peer_list_element *next, *prev; 116 struct peer_list_element *next, *prev;
118 117
119 /* The handle that sends the hellos to this peer */ 118 /* The handle that sends the hellos to this peer */
@@ -154,7 +153,7 @@ send_end_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
154 153
155 struct GNUNET_MESH_Tunnel *tunnel = cls; 154 struct GNUNET_MESH_Tunnel *tunnel = cls;
156 155
157 tunnel->connect_handler (tunnel->handler_cls, NULL, NULL); 156 tunnel->connect_handler (tunnel->handler_cls, NULL, NULL, 0);
158} 157}
159 158
160static void 159static void
@@ -165,7 +164,7 @@ send_self_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
165 164
166 struct GNUNET_MESH_Tunnel *tunnel = cls; 165 struct GNUNET_MESH_Tunnel *tunnel = cls;
167 166
168 tunnel->connect_handler (tunnel->handler_cls, &tunnel->handle->myself, NULL); 167 tunnel->connect_handler (tunnel->handler_cls, &tunnel->handle->myself, NULL, 0);
169 GNUNET_SCHEDULER_add_now (send_end_connect, tunnel); 168 GNUNET_SCHEDULER_add_now (send_end_connect, tunnel);
170} 169}
171 170
@@ -177,7 +176,7 @@ call_connect_handler (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
177 176
178 struct GNUNET_MESH_Tunnel *tunnel = cls; 177 struct GNUNET_MESH_Tunnel *tunnel = cls;
179 178
180 tunnel->connect_handler (tunnel->handler_cls, &tunnel->peer, NULL); 179 tunnel->connect_handler (tunnel->handler_cls, &tunnel->peer, NULL, 0);
181 GNUNET_SCHEDULER_add_now (send_end_connect, tunnel); 180 GNUNET_SCHEDULER_add_now (send_end_connect, tunnel);
182} 181}
183 182
@@ -254,7 +253,8 @@ schedule_hello_message (void *cls,
254 */ 253 */
255static void 254static void
256core_connect (void *cls, const struct GNUNET_PeerIdentity *peer, 255core_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
257 const struct GNUNET_ATS_Information *atsi) 256 const struct GNUNET_ATS_Information *atsi,
257 unsigned int atsi_count)
258{ 258{
259 struct GNUNET_MESH_Handle *handle = cls; 259 struct GNUNET_MESH_Handle *handle = cls;
260 260
@@ -269,11 +269,6 @@ core_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
269 269
270 /* Send a hello to this peer */ 270 /* Send a hello to this peer */
271 element->sched = GNUNET_SCHEDULER_add_now (schedule_hello_message, element); 271 element->sched = GNUNET_SCHEDULER_add_now (schedule_hello_message, element);
272
273 if (NULL != atsi)
274 memcpy (&element->atsi, atsi,
275 sizeof (struct GNUNET_ATS_Information));
276
277 GNUNET_CONTAINER_DLL_insert_after (handle->connected_peers.head, 272 GNUNET_CONTAINER_DLL_insert_after (handle->connected_peers.head,
278 handle->connected_peers.tail, 273 handle->connected_peers.tail,
279 handle->connected_peers.tail, element); 274 handle->connected_peers.tail, element);
@@ -294,7 +289,7 @@ core_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
294 handle->established_tunnels.tail, 289 handle->established_tunnels.tail,
295 handle->established_tunnels.tail, 290 handle->established_tunnels.tail,
296 tunnel); 291 tunnel);
297 tunnel->tunnel.connect_handler (tunnel->tunnel.handler_cls, peer, atsi); 292 tunnel->tunnel.connect_handler (tunnel->tunnel.handler_cls, peer, atsi, atsi_count);
298 GNUNET_SCHEDULER_add_now (send_end_connect, tunnel); 293 GNUNET_SCHEDULER_add_now (send_end_connect, tunnel);
299 tunnel = next; 294 tunnel = next;
300 } 295 }
@@ -383,7 +378,8 @@ core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
383static int 378static int
384receive_hello (void *cls, const struct GNUNET_PeerIdentity *other, 379receive_hello (void *cls, const struct GNUNET_PeerIdentity *other,
385 const struct GNUNET_MessageHeader *message, 380 const struct GNUNET_MessageHeader *message,
386 const struct GNUNET_ATS_Information *atsi) 381 const struct GNUNET_ATS_Information *atsi,
382 unsigned int atsi_count)
387{ 383{
388 struct GNUNET_MESH_Handle *handle = cls; 384 struct GNUNET_MESH_Handle *handle = cls;
389 uint16_t *num = (uint16_t *) (message + 1); 385 uint16_t *num = (uint16_t *) (message + 1);
@@ -450,7 +446,7 @@ receive_hello (void *cls, const struct GNUNET_PeerIdentity *other,
450 memcpy (&tunnel->tunnel.peer, other, 446 memcpy (&tunnel->tunnel.peer, other,
451 sizeof (struct GNUNET_PeerIdentity)); 447 sizeof (struct GNUNET_PeerIdentity));
452 tunnel->tunnel.connect_handler (tunnel->tunnel.handler_cls, 448 tunnel->tunnel.connect_handler (tunnel->tunnel.handler_cls,
453 &tunnel->tunnel.peer, atsi); 449 &tunnel->tunnel.peer, atsi, atsi_count);
454 GNUNET_SCHEDULER_add_now (send_end_connect, tunnel); 450 GNUNET_SCHEDULER_add_now (send_end_connect, tunnel);
455 break; 451 break;
456 } 452 }
@@ -469,7 +465,8 @@ receive_hello (void *cls, const struct GNUNET_PeerIdentity *other,
469static int 465static int
470core_receive (void *cls, const struct GNUNET_PeerIdentity *other, 466core_receive (void *cls, const struct GNUNET_PeerIdentity *other,
471 const struct GNUNET_MessageHeader *message, 467 const struct GNUNET_MessageHeader *message,
472 const struct GNUNET_ATS_Information *atsi) 468 const struct GNUNET_ATS_Information *atsi,
469 unsigned int atsi_count)
473{ 470{
474 struct GNUNET_MESH_Handle *handle = cls; 471 struct GNUNET_MESH_Handle *handle = cls;
475 struct tunnel_message *tmessage = (struct tunnel_message *) message; 472 struct tunnel_message *tmessage = (struct tunnel_message *) message;
@@ -539,7 +536,7 @@ core_receive (void *cls, const struct GNUNET_PeerIdentity *other,
539 GNUNET_i2s (other), ntohs (rmessage->type)); 536 GNUNET_i2s (other), ntohs (rmessage->type));
540 537
541 return handler->callback (handle->cls, &tunnel->tunnel, &tunnel->tunnel.ctx, 538 return handler->callback (handle->cls, &tunnel->tunnel, &tunnel->tunnel.ctx,
542 other, rmessage, atsi); 539 other, rmessage, atsi, atsi_count);
543} 540}
544 541
545struct GNUNET_MESH_Tunnel * 542struct GNUNET_MESH_Tunnel *