From: Christian Grothoff Date: Wed, 18 Jan 2017 15:56:01 +0000 (+0100) Subject: work towards routing X-Git-Tag: taler-0.2.1~413 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=3edc21c27d208e45dc1af76131a480a3ebf1e8d3;p=oweals%2Fgnunet.git work towards routing --- diff --git a/src/cadet/gnunet-service-cadet-new_core.c b/src/cadet/gnunet-service-cadet-new_core.c index d81600b9d..e9fc6bf05 100644 --- a/src/cadet/gnunet-service-cadet-new_core.c +++ b/src/cadet/gnunet-service-cadet-new_core.c @@ -56,6 +56,16 @@ struct CadetRoute */ struct CadetPeer *next_hop; + /** + * Message queue notifications for @e prev_hop. + */ + struct GCP_MessageQueueManager *prev_mqm; + + /** + * Message queue notifications for @e next_hop. + */ + struct GCP_MessageQueueManager *next_mqm; + /** * Unique identifier for the connection that uses this route. */ @@ -123,8 +133,9 @@ route_message (struct CadetPeer *prev, env); return; } - GNUNET_assert (0); /* FIXME: determine next hop from route and prev! */ - + /* FIXME: support round-robin queue management here somewhere! */ + GCP_send ((prev == route->prev_hop) ? route->next_hop : route->prev_hop, + GNUNET_MQ_msg_copy (msg)); } @@ -159,7 +170,9 @@ check_connection_create (void *cls, static void destroy_route (struct CadetRoute *route) { - GNUNET_break (0); // fIXME: implement! + GCP_request_mq_cancel (route->next_mqm); + GCP_request_mq_cancel (route->prev_mqm); + GNUNET_free (route); } @@ -173,16 +186,57 @@ static void handle_connection_create (void *cls, const struct GNUNET_CADET_ConnectionCreateMessage *msg) { - struct CadetPeer *peer = cls; + struct CadetPeer *sender = cls; + struct CadetPeer *next; + const struct GNUNET_PeerIdentity *pids = (const struct GNUNET_PeerIdentity *) &msg[1]; + struct CadetRoute *route; uint16_t size = ntohs (msg->header.size) - sizeof (*msg); unsigned int path_length; + unsigned int off; path_length = size / sizeof (struct GNUNET_PeerIdentity); + /* Initiator is at offset 0. */ + for (off=1;offcid, path_length, - (const struct GNUNET_PeerIdentity *) &msg[1]); + route); #endif }