diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-01-12 08:52:21 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-01-12 08:52:21 +0000 |
commit | 564f7d6ca787ffaeb055cbba0f8c778a0dca037d (patch) | |
tree | 2f1f2ab607937ab0ad9d065b97d86972ae405eb1 /src/mesh/mesh_api.c | |
parent | 7679d8153a934d67023e856fbb37dd0d1663f273 (diff) | |
download | gnunet-564f7d6ca787ffaeb055cbba0f8c778a0dca037d.tar.gz gnunet-564f7d6ca787ffaeb055cbba0f8c778a0dca037d.zip |
fixes
Diffstat (limited to 'src/mesh/mesh_api.c')
-rw-r--r-- | src/mesh/mesh_api.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/mesh/mesh_api.c b/src/mesh/mesh_api.c index f1f9b17ab..c424dfd99 100644 --- a/src/mesh/mesh_api.c +++ b/src/mesh/mesh_api.c | |||
@@ -32,7 +32,7 @@ | |||
32 | 32 | ||
33 | struct tunnel_id | 33 | struct tunnel_id |
34 | { | 34 | { |
35 | uint32_t id; | 35 | uint32_t id GNUNET_PACKED; |
36 | struct GNUNET_PeerIdentity initiator; | 36 | struct GNUNET_PeerIdentity initiator; |
37 | struct GNUNET_PeerIdentity target; | 37 | struct GNUNET_PeerIdentity target; |
38 | }; | 38 | }; |
@@ -262,9 +262,9 @@ core_receive (void *cls, | |||
262 | 262 | ||
263 | for (handler = handle->handlers; handler != NULL; handler++) | 263 | for (handler = handle->handlers; handler != NULL; handler++) |
264 | { | 264 | { |
265 | if (ntohs (rmessage->type) == handler->type | 265 | if ( (ntohs (rmessage->type) == handler->type) |
266 | && (handler->expected_size == 0 | 266 | && ( (handler->expected_size == 0) |
267 | || handler->expected_size == ntohs (rmessage->size))) | 267 | || (handler->expected_size == ntohs (rmessage->size))) ) |
268 | { | 268 | { |
269 | break; | 269 | break; |
270 | } | 270 | } |
@@ -378,6 +378,10 @@ GNUNET_MESH_peer_request_connect_all (struct GNUNET_MESH_Handle *handle, | |||
378 | handle->pending_tunnels.tail, | 378 | handle->pending_tunnels.tail, |
379 | handle->pending_tunnels.tail, | 379 | handle->pending_tunnels.tail, |
380 | tunnel); | 380 | tunnel); |
381 | (void) GNUNET_CORE_peer_request_connect (handle->core, | ||
382 | timeout, | ||
383 | peers, | ||
384 | NULL, NULL); | ||
381 | } | 385 | } |
382 | 386 | ||
383 | return &tunnel->tunnel; | 387 | return &tunnel->tunnel; |
@@ -394,7 +398,7 @@ core_notify(void* cls, size_t size, void* buf) | |||
394 | { | 398 | { |
395 | struct GNUNET_MESH_Tunnel *tunnel = cls; | 399 | struct GNUNET_MESH_Tunnel *tunnel = cls; |
396 | struct tunnel_message* message = buf; | 400 | struct tunnel_message* message = buf; |
397 | void* cbuf = (void*)(message + 1); | 401 | void* cbuf = (void*) &message[1]; |
398 | 402 | ||
399 | size_t sent = tunnel->notify(tunnel->notify_cls, size - sizeof(struct tunnel_message), cbuf); | 403 | size_t sent = tunnel->notify(tunnel->notify_cls, size - sizeof(struct tunnel_message), cbuf); |
400 | 404 | ||
@@ -430,11 +434,11 @@ GNUNET_MESH_notify_transmit_ready (struct | |||
430 | maxdelay, | 434 | maxdelay, |
431 | &tunnel->peer, | 435 | &tunnel->peer, |
432 | notify_size + sizeof(struct tunnel_message), | 436 | notify_size + sizeof(struct tunnel_message), |
433 | core_notify, | 437 | &core_notify, |
434 | (void*)tunnel); | 438 | (void*)tunnel); |
435 | 439 | ||
436 | /* aborting is not implemented yet */ | 440 | /* aborting is not implemented yet */ |
437 | return (struct GNUNET_MESH_TransmitHandle*)1; | 441 | return (struct GNUNET_MESH_TransmitHandle*) 1; |
438 | } | 442 | } |
439 | 443 | ||
440 | 444 | ||
@@ -454,7 +458,7 @@ GNUNET_MESH_connect (const struct | |||
454 | ret->connected_peers.tail = NULL; | 458 | ret->connected_peers.tail = NULL; |
455 | ret->cleaner = cleaner; | 459 | ret->cleaner = cleaner; |
456 | ret->cls = cls; | 460 | ret->cls = cls; |
457 | 461 | ||
458 | const struct GNUNET_MESH_MessageHandler *it; | 462 | const struct GNUNET_MESH_MessageHandler *it; |
459 | unsigned int len = 1; | 463 | unsigned int len = 1; |
460 | for (it = handlers; it->callback != NULL; it++) | 464 | for (it = handlers; it->callback != NULL; it++) |
@@ -468,16 +472,16 @@ GNUNET_MESH_connect (const struct | |||
468 | len * sizeof (struct GNUNET_MESH_MessageHandler)); | 472 | len * sizeof (struct GNUNET_MESH_MessageHandler)); |
469 | 473 | ||
470 | const static struct GNUNET_CORE_MessageHandler core_handlers[] = { | 474 | const static struct GNUNET_CORE_MessageHandler core_handlers[] = { |
471 | {core_receive, GNUNET_MESSAGE_TYPE_MESH, 0}, | 475 | {&core_receive, GNUNET_MESSAGE_TYPE_MESH, 0}, |
472 | {NULL, 0, 0} | 476 | {NULL, 0, 0} |
473 | }; | 477 | }; |
474 | 478 | ||
475 | ret->core = GNUNET_CORE_connect (cfg, | 479 | ret->core = GNUNET_CORE_connect (cfg, |
476 | 42, | 480 | 42, |
477 | ret, | 481 | ret, |
478 | core_startup, | 482 | &core_startup, |
479 | core_connect, | 483 | &core_connect, |
480 | core_disconnect, | 484 | &core_disconnect, |
481 | NULL, | 485 | NULL, |
482 | NULL, | 486 | NULL, |
483 | GNUNET_NO, NULL, GNUNET_NO, core_handlers); | 487 | GNUNET_NO, NULL, GNUNET_NO, core_handlers); |
@@ -516,4 +520,4 @@ GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle) | |||
516 | GNUNET_free (handle); | 520 | GNUNET_free (handle); |
517 | } | 521 | } |
518 | 522 | ||
519 | /* end of core_api.c */ | 523 | /* end of mesh_api.c */ |