diff options
author | Bart Polot <bart@net.in.tum.de> | 2011-05-03 10:05:53 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2011-05-03 10:05:53 +0000 |
commit | af3a0a51afe30d42aa838d9df3fee4ad80054a98 (patch) | |
tree | da4586df873b020101ad6e1e81d25374531bc7d6 | |
parent | b869c58f5e200d802f4f764d802e1569ca041b6a (diff) | |
download | gnunet-af3a0a51afe30d42aa838d9df3fee4ad80054a98.tar.gz gnunet-af3a0a51afe30d42aa838d9df3fee4ad80054a98.zip |
WiP
-rw-r--r-- | src/mesh/gnunet-service-mesh.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index 1ffcb848d..9784d61aa 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c | |||
@@ -488,6 +488,31 @@ static GNUNET_PEER_Id myid; | |||
488 | /******************************************************************************/ | 488 | /******************************************************************************/ |
489 | 489 | ||
490 | /** | 490 | /** |
491 | * Function called to notify a client about the socket | ||
492 | * begin ready to queue more data. "buf" will be | ||
493 | * NULL and "size" zero if the socket was closed for | ||
494 | * writing in the meantime. | ||
495 | * | ||
496 | * @param cls closure | ||
497 | * @param size number of bytes available in buf | ||
498 | * @param buf where the callee should write the message | ||
499 | * @return number of bytes written to buf | ||
500 | */ | ||
501 | size_t feed_data_to_core (void *cls, size_t size, void *buf) { | ||
502 | size_t size_used; | ||
503 | PeerInfo *peer_info; | ||
504 | |||
505 | if(0 == size && NULL == buf) { | ||
506 | // FIXME retry? cancel? | ||
507 | } | ||
508 | size_used = 0; | ||
509 | peer_info = (struct PeerInfo *)cls; | ||
510 | |||
511 | return size_used; | ||
512 | } | ||
513 | |||
514 | |||
515 | /** | ||
491 | * Core handler for path creation | 516 | * Core handler for path creation |
492 | * struct GNUNET_CORE_MessageHandler | 517 | * struct GNUNET_CORE_MessageHandler |
493 | * | 518 | * |
@@ -602,11 +627,38 @@ void dht_get_response_handler(void *cls, | |||
602 | struct PeerInfo *peer_info; | 627 | struct PeerInfo *peer_info; |
603 | struct MESH_tunnel *t; | 628 | struct MESH_tunnel *t; |
604 | struct Path *p; | 629 | struct Path *p; |
630 | int i; | ||
605 | 631 | ||
606 | peer_info = (struct PeerInfo *)cls; | 632 | peer_info = (struct PeerInfo *)cls; |
607 | t = peer_info->t; | 633 | t = peer_info->t; |
608 | p = GNUNET_malloc(sizeof(struct Path)); | 634 | p = GNUNET_malloc(sizeof(struct Path)); |
609 | GNUNET_CONTAINER_DLL_insert(t->paths_head, t->paths_tail, p); | 635 | GNUNET_CONTAINER_DLL_insert(t->paths_head, t->paths_tail, p); |
636 | for(i = 0; get_path[i] != NULL; i++) { | ||
637 | p->peers = GNUNET_realloc(p->peers, | ||
638 | sizeof(GNUNET_PEER_Id) * (p->length + 1)); | ||
639 | p->peers[p->length] = GNUNET_PEER_intern(get_path[i]); | ||
640 | p->length++; | ||
641 | } | ||
642 | for(i = 0; put_path[i] != NULL; i++) { | ||
643 | p->peers = GNUNET_realloc(p->peers, | ||
644 | sizeof(GNUNET_PEER_Id) * (p->length + 1)); | ||
645 | p->peers[p->length] = GNUNET_PEER_intern(put_path[i]); | ||
646 | p->length++; | ||
647 | } | ||
648 | // p->id = 0; // FIXME generate ID or remove field | ||
649 | p->in_use = 0; | ||
650 | // peer_info->first_hop = p->peers[1]; // FIXME do this on path completion | ||
651 | GNUNET_CORE_notify_transmit_ready(core_handle, | ||
652 | 0, | ||
653 | 0, | ||
654 | GNUNET_TIME_relative_get_forever(), | ||
655 | get_path[1], | ||
656 | sizeof(struct GNUNET_MESH_ManipulatePath) | ||
657 | + (p->length | ||
658 | * sizeof (struct GNUNET_PeerIdentity)), | ||
659 | feed_data_to_core, | ||
660 | peer_info | ||
661 | ); | ||
610 | return; | 662 | return; |
611 | } | 663 | } |
612 | 664 | ||