X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fmesh%2Fgnunet-service-mesh.c;h=b17412b0243884c2ae6dc940663a545432993d12;hb=03b222dc177798ed9448cdeca67ba4051c6397e3;hp=2c907ffb92a49cc08c4804f15b17c9f3c3efe3f3;hpb=2a92c9a49235f0ea9009525307e706b75d7b28dc;p=oweals%2Fgnunet.git diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index 2c907ffb9..b17412b02 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c @@ -95,7 +95,7 @@ if (0 < __count)\ /******************************************************************************/ /** FWD declaration */ -struct MeshPeerInfo; +struct MeshPeer; struct MeshClient; @@ -117,7 +117,7 @@ struct MeshPeerQueue /** * Peer this transmission is directed to. */ - struct MeshPeerInfo *peer; + struct MeshPeer *peer; /** * Tunnel this message belongs to. @@ -144,7 +144,7 @@ struct MeshPeerQueue /** * Struct containing all information regarding a given peer */ -struct MeshPeerInfo +struct MeshPeer { /** * ID of the peer @@ -511,7 +511,7 @@ struct MeshTunnel /** * Struct containing information about a client of the service - * + * * TODO: add a list of 'waiting' ports */ struct MeshClient @@ -626,7 +626,7 @@ static unsigned long long dht_replication_level; static unsigned long long max_tunnels; /** - * How many messages *in total* are we willing to queue, divided by number of + * How many messages *in total* are we willing to queue, divided by number of * tunnels to get tunnel queue size. */ static unsigned long long max_msgs_queue; @@ -670,9 +670,9 @@ static unsigned long long n_tunnels; static struct GNUNET_CONTAINER_MultiHashMap32 *incoming_tunnels; /** - * Peers known, indexed by PeerIdentity (MeshPeerInfo). + * Peers known, indexed by PeerIdentity (MeshPeer). */ -static struct GNUNET_CONTAINER_MultiHashMap *peers; +static struct GNUNET_CONTAINER_MultiPeerMap *peers; /* * Handle to communicate with transport @@ -717,12 +717,7 @@ static struct GNUNET_PeerIdentity my_full_id; /** * Own private key. */ -static struct GNUNET_CRYPTO_EccPrivateKey *my_private_key; - -/** - * Own public key. - */ -static struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded my_public_key; +static struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key; /** * Tunnel ID for the next created tunnel (global tunnel number). @@ -777,26 +772,26 @@ dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp, /** - * Retrieve the MeshPeerInfo stucture associated with the peer, create one + * Retrieve the MeshPeer stucture associated with the peer, create one * and insert it in the appropriate structures if the peer is not known yet. * * @param peer Full identity of the peer. * * @return Existing or newly created peer info. */ -static struct MeshPeerInfo * +static struct MeshPeer * peer_get (const struct GNUNET_PeerIdentity *peer); /** - * Retrieve the MeshPeerInfo stucture associated with the peer, create one + * Retrieve the MeshPeer stucture associated with the peer, create one * and insert it in the appropriate structures if the peer is not known yet. * * @param peer Short identity of the peer. * * @return Existing or newly created peer info. */ -static struct MeshPeerInfo * +static struct MeshPeer * peer_get_short (const GNUNET_PEER_Id peer); @@ -884,7 +879,7 @@ tunnel_bck_keepalive (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); * @brief Use the given path for the tunnel. * Update the next and prev hops (and RCs). * (Re)start the path refresh in case the tunnel is locally owned. - * + * * @param t Tunnel to update. * @param p Path to use. */ @@ -893,10 +888,10 @@ tunnel_use_path (struct MeshTunnel *t, struct MeshPeerPath *p); /** * Tunnel is empty: destroy it. - * + * * Notifies all participants (peers, cleints) about the destruction. - * - * @param t Tunnel to destroy. + * + * @param t Tunnel to destroy. */ static void tunnel_destroy_empty (struct MeshTunnel *t); @@ -920,12 +915,12 @@ tunnel_destroy (struct MeshTunnel *t); /** * @brief Queue and pass message to core when possible. - * + * * If type is payload (UNICAST, TO_ORIGIN, MULTICAST) checks for queue status * and accounts for it. In case the queue is full, the message is dropped and * a break issued. - * - * Otherwise, message is treated as internal and allowed to go regardless of + * + * Otherwise, message is treated as internal and allowed to go regardless of * queue status. * * @param cls Closure (@c type dependant). It will be used by queue_send to @@ -937,7 +932,7 @@ tunnel_destroy (struct MeshTunnel *t); */ static void queue_add (void *cls, uint16_t type, size_t size, - struct MeshPeerInfo *dst, struct MeshTunnel *t); + struct MeshPeer *dst, struct MeshTunnel *t); /** @@ -963,7 +958,7 @@ queue_destroy (struct MeshPeerQueue *queue, int clear_cls); * NULL when there are no transmittable messages. */ struct MeshPeerQueue * -queue_get_next (const struct MeshPeerInfo *peer); +queue_get_next (const struct MeshPeer *peer); /** @@ -1039,6 +1034,7 @@ static void announce_id (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct PBlock block; + struct GNUNET_HashCode phash; if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) { @@ -1050,10 +1046,10 @@ announce_id (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * - Adapt X to churn */ DEBUG_DHT ("DHT_put for ID %s started.\n", GNUNET_i2s (&my_full_id)); - + GNUNET_CRYPTO_hash (&my_full_id, sizeof (my_full_id), &phash); block.id = my_full_id; GNUNET_DHT_put (dht_handle, /* DHT handle */ - &my_full_id.hashPubKey, /* Key to use */ + &phash, dht_replication_level, /* Replication level */ GNUNET_DHT_RO_RECORD_ROUTE | GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, /* DHT options */ GNUNET_BLOCK_TYPE_MESH_PEER, /* Block type */ @@ -1173,7 +1169,7 @@ send_local_tunnel_destroy (struct MeshTunnel *t, int fwd) /** * Build a local ACK message and send it to a local client. - * + * * @param t Tunnel on which to send the ACK. * @param c Client to whom send the ACK. * @param is_fwd Set to GNUNET_YES for FWD ACK (dest->owner) @@ -1210,7 +1206,7 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message, struct MeshTunnel *t) { struct GNUNET_PeerIdentity id; - struct MeshPeerInfo *neighbor; + struct MeshPeer *neighbor; struct MeshPeerPath *p; void *data; size_t size; @@ -1294,7 +1290,7 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message, static void send_path_create (struct MeshTunnel *t) { - struct MeshPeerInfo *neighbor; + struct MeshPeer *neighbor; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Send create path\n"); neighbor = peer_get_short (t->next_hop); @@ -1314,9 +1310,9 @@ send_path_create (struct MeshTunnel *t) * @param t Tunnel which to confirm. */ static void -send_path_ack (struct MeshTunnel *t) +send_path_ack (struct MeshTunnel *t) { - struct MeshPeerInfo *neighbor; + struct MeshPeer *neighbor; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Send path ack\n"); neighbor = peer_get_short (t->prev_hop); @@ -1331,7 +1327,7 @@ send_path_ack (struct MeshTunnel *t) /** * Build an ACK message and queue it to send to the given peer. - * + * * @param t Tunnel on which to send the ACK. * @param peer Peer to whom send the ACK. * @param ack Value of the ACK. @@ -1479,62 +1475,59 @@ send_core_path_ack (void *cls, size_t size, void *buf) * FIXME implement */ static int -peer_info_timeout (void *cls, - const struct GNUNET_HashCode *key, - void *value) +peer_timeout (void *cls, + const struct GNUNET_PeerIdentity *key, + void *value) { return GNUNET_YES; } + /** - * Retrieve the MeshPeerInfo stucture associated with the peer, create one + * Retrieve the MeshPeer stucture associated with the peer, create one * and insert it in the appropriate structures if the peer is not known yet. * * @param peer Full identity of the peer. * * @return Existing or newly created peer info. */ -static struct MeshPeerInfo * -peer_get (const struct GNUNET_PeerIdentity *peer) +static struct MeshPeer * +peer_get (const struct GNUNET_PeerIdentity *peer_id) { - struct MeshPeerInfo *peer_info; + struct MeshPeer *peer; - peer_info = GNUNET_CONTAINER_multihashmap_get (peers, &peer->hashPubKey); - if (NULL == peer_info) + peer = GNUNET_CONTAINER_multipeermap_get (peers, peer_id); + if (NULL == peer) { - peer_info = - (struct MeshPeerInfo *) GNUNET_malloc (sizeof (struct MeshPeerInfo)); - if (GNUNET_CONTAINER_multihashmap_size (peers) > max_peers) + peer = GNUNET_new (struct MeshPeer); + if (GNUNET_CONTAINER_multipeermap_size (peers) > max_peers) { - GNUNET_CONTAINER_multihashmap_iterate (peers, - &peer_info_timeout, + GNUNET_CONTAINER_multipeermap_iterate (peers, + &peer_timeout, NULL); } - GNUNET_CONTAINER_multihashmap_put (peers, &peer->hashPubKey, peer_info, + GNUNET_CONTAINER_multipeermap_put (peers, peer_id, peer, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); - peer_info->id = GNUNET_PEER_intern (peer); + peer->id = GNUNET_PEER_intern (peer_id); } - peer_info->last_contact = GNUNET_TIME_absolute_get(); + peer->last_contact = GNUNET_TIME_absolute_get(); - return peer_info; + return peer; } /** - * Retrieve the MeshPeerInfo stucture associated with the peer, create one + * Retrieve the MeshPeer stucture associated with the peer, create one * and insert it in the appropriate structures if the peer is not known yet. * * @param peer Short identity of the peer. * * @return Existing or newly created peer info. */ -static struct MeshPeerInfo * +static struct MeshPeer * peer_get_short (const GNUNET_PEER_Id peer) { - struct GNUNET_PeerIdentity id; - - GNUNET_PEER_resolve (peer, &id); - return peer_get (&id); + return peer_get (GNUNET_PEER_resolve2 (peer)); } @@ -1543,19 +1536,19 @@ peer_get_short (const GNUNET_PEER_Id peer) * * @param pi Peer we want to poll. * @param t Tunnel about which we want to poll. - * + * * @return PID to use, either last sent or first_in_queue - 1 */ static uint32_t -peer_get_first_payload_pid (struct MeshPeerInfo *pi, struct MeshTunnel *t) +peer_get_first_payload_pid (struct MeshPeer *p, struct MeshTunnel *t) { struct MeshPeerQueue *q; uint16_t type; - type = pi->id == t->next_hop ? GNUNET_MESSAGE_TYPE_MESH_UNICAST : + type = p->id == t->next_hop ? GNUNET_MESSAGE_TYPE_MESH_UNICAST : GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN; - for (q = pi->queue_head; NULL != q; q = q->next) + for (q = p->queue_head; NULL != q; q = q->next) { if (q->type == type && q->tunnel == t) { @@ -1570,7 +1563,7 @@ peer_get_first_payload_pid (struct MeshPeerInfo *pi, struct MeshTunnel *t) { struct MeshFlowControl *fc; - fc = pi->id == t->next_hop ? &t->next_fc : &t->prev_fc; + fc = p->id == t->next_hop ? &t->next_fc : &t->prev_fc; return fc->last_pid_sent; } } @@ -1578,14 +1571,14 @@ peer_get_first_payload_pid (struct MeshPeerInfo *pi, struct MeshTunnel *t) /** * Choose the best path towards a peer considering the tunnel properties. - * + * * @param peer The destination peer. * @param t The tunnel the path is for. * * @return Best current known path towards the peer, if any. */ static struct MeshPeerPath * -peer_get_best_path (const struct MeshPeerInfo *peer, const struct MeshTunnel *t) +peer_get_best_path (const struct MeshPeer *peer, const struct MeshTunnel *t) { struct MeshPeerPath *best_p; struct MeshPeerPath *p; @@ -1601,7 +1594,7 @@ peer_get_best_path (const struct MeshPeerInfo *peer, const struct MeshTunnel *t) best_cost = cost; best_p = p; } - p = p->next; + p = p->next; } return best_p; } @@ -1616,9 +1609,10 @@ peer_get_best_path (const struct MeshPeerInfo *peer, const struct MeshTunnel *t) * @param t Tunnel for which to create the path, if possible. */ static void -peer_connect (struct MeshPeerInfo *peer, struct MeshTunnel *t) +peer_connect (struct MeshPeer *peer, struct MeshTunnel *t) { struct MeshPeerPath *p; + struct GNUNET_HashCode phash; if (NULL != peer->path_head) { @@ -1632,10 +1626,12 @@ peer_connect (struct MeshPeerInfo *peer, struct MeshTunnel *t) GNUNET_PEER_resolve (peer->id, &id); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - " Starting DHT GET for peer %s\n", GNUNET_i2s (&id)); + "Starting DHT GET for peer %s\n", + GNUNET_i2s (&id)); + GNUNET_CRYPTO_hash (&id, sizeof (my_full_id), &phash); peer->dhtget = GNUNET_DHT_get_start (dht_handle, /* handle */ GNUNET_BLOCK_TYPE_MESH_PEER, /* type */ - &id.hashPubKey, /* key to search */ + &phash, /* key to search */ dht_replication_level, /* replication level */ GNUNET_DHT_RO_RECORD_ROUTE | GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, @@ -1664,7 +1660,7 @@ peer_connect (struct MeshPeerInfo *peer, struct MeshTunnel *t) static void peer_unlock_queue (GNUNET_PEER_Id peer_id) { - struct MeshPeerInfo *peer; + struct MeshPeer *peer; struct MeshPeerQueue *q; size_t size; @@ -1692,39 +1688,39 @@ peer_unlock_queue (GNUNET_PEER_Id peer_id) /** * Cancel all transmissions towards a neighbor that belong to a certain tunnel. * - * @param t Tunnel which to cancel. * @param neighbor Short ID of the neighbor to whom cancel the transmissions. + * @param t Tunnel which to cancel. */ static void peer_cancel_queues (GNUNET_PEER_Id neighbor, struct MeshTunnel *t) { - struct MeshPeerInfo *peer_info; - struct MeshPeerQueue *pq; + struct MeshPeer *peer; + struct MeshPeerQueue *q; struct MeshPeerQueue *next; struct MeshFlowControl *fc; if (0 == neighbor) return; /* Was local peer, 0'ed in tunnel_destroy_iterator */ - peer_info = peer_get_short (neighbor); - for (pq = peer_info->queue_head; NULL != pq; pq = next) + peer = peer_get_short (neighbor); + for (q = peer->queue_head; NULL != q; q = next) { - next = pq->next; - if (pq->tunnel == t) + next = q->next; + if (q->tunnel == t) { - if (GNUNET_MESSAGE_TYPE_MESH_UNICAST == pq->type || - GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN == pq->type) + if (GNUNET_MESSAGE_TYPE_MESH_UNICAST == q->type || + GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN == q->type) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "peer_cancel_queues %s\n", - GNUNET_MESH_DEBUG_M2S (pq->type)); + GNUNET_MESH_DEBUG_M2S (q->type)); } - queue_destroy (pq, GNUNET_YES); + queue_destroy (q, GNUNET_YES); } } - if (NULL == peer_info->queue_head && NULL != peer_info->core_transmit) + if (NULL == peer->queue_head && NULL != peer->core_transmit) { - GNUNET_CORE_notify_transmit_ready_cancel (peer_info->core_transmit); - peer_info->core_transmit = NULL; + GNUNET_CORE_notify_transmit_ready_cancel (peer->core_transmit); + peer->core_transmit = NULL; } fc = neighbor == t->next_hop ? &t->next_fc : &t->prev_fc; if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task) @@ -1738,44 +1734,44 @@ peer_cancel_queues (GNUNET_PEER_Id neighbor, struct MeshTunnel *t) /** * Destroy the peer_info and free any allocated resources linked to it * - * @param pi The peer_info to destroy. + * @param peer The peer_info to destroy. * * @return GNUNET_OK on success */ static int -peer_info_destroy (struct MeshPeerInfo *pi) +peer_destroy (struct MeshPeer *peer) { struct GNUNET_PeerIdentity id; struct MeshPeerPath *p; struct MeshPeerPath *nextp; unsigned int i; - GNUNET_PEER_resolve (pi->id, &id); - GNUNET_PEER_change_rc (pi->id, -1); + GNUNET_PEER_resolve (peer->id, &id); + GNUNET_PEER_change_rc (peer->id, -1); if (GNUNET_YES != - GNUNET_CONTAINER_multihashmap_remove (peers, &id.hashPubKey, pi)) + GNUNET_CONTAINER_multipeermap_remove (peers, &id, peer)) { GNUNET_break (0); GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "removing peer %s, not in hashmap\n", GNUNET_i2s (&id)); } - if (NULL != pi->dhtget) + if (NULL != peer->dhtget) { - GNUNET_DHT_get_stop (pi->dhtget); + GNUNET_DHT_get_stop (peer->dhtget); } - p = pi->path_head; + p = peer->path_head; while (NULL != p) { nextp = p->next; - GNUNET_CONTAINER_DLL_remove (pi->path_head, pi->path_tail, p); + GNUNET_CONTAINER_DLL_remove (peer->path_head, peer->path_tail, p); path_destroy (p); p = nextp; } - for (i = 0; i < pi->ntunnels; i++) - tunnel_destroy_empty (pi->tunnels[i]); - GNUNET_array_grow (pi->tunnels, pi->ntunnels, 0); - GNUNET_free (pi); + for (i = 0; i < peer->ntunnels; i++) + tunnel_destroy_empty (peer->tunnels[i]); + GNUNET_array_grow (peer->tunnels, peer->ntunnels, 0); + GNUNET_free (peer); return GNUNET_OK; } @@ -1792,12 +1788,12 @@ peer_info_destroy (struct MeshPeerInfo *pi) * TODO: optimize (see below) */ static void -peer_info_remove_path (struct MeshPeerInfo *peer, GNUNET_PEER_Id p1, +peer_remove_path (struct MeshPeer *peer, GNUNET_PEER_Id p1, GNUNET_PEER_Id p2) { struct MeshPeerPath *p; struct MeshPeerPath *next; - struct MeshPeerInfo *peer_d; + struct MeshPeer *peer_d; GNUNET_PEER_Id d; unsigned int destroyed; unsigned int i; @@ -1847,7 +1843,7 @@ peer_info_remove_path (struct MeshPeerInfo *peer, GNUNET_PEER_Id p1, * @param trusted Do we trust that this path is real? */ void -peer_info_add_path (struct MeshPeerInfo *peer_info, struct MeshPeerPath *path, +peer_add_path (struct MeshPeer *peer_info, struct MeshPeerPath *path, int trusted) { struct MeshPeerPath *aux; @@ -1940,23 +1936,23 @@ peer_info_add_path (struct MeshPeerInfo *peer_info, struct MeshPeerPath *path, * @param trusted Do we trust that this path is real? */ static void -peer_info_add_path_to_origin (struct MeshPeerInfo *peer_info, - struct MeshPeerPath *path, int trusted) +peer_add_path_to_origin (struct MeshPeer *peer_info, + struct MeshPeerPath *path, int trusted) { path_invert (path); - peer_info_add_path (peer_info, path, trusted); + peer_add_path (peer_info, path, trusted); } /** * Add a tunnel to the list of tunnels a peer participates in. * Update the tunnel's destination. - * + * * @param p Peer to add to. * @param t Tunnel to add. */ static void -peer_info_add_tunnel (struct MeshPeerInfo *p, struct MeshTunnel *t) +peer_add_tunnel (struct MeshPeer *p, struct MeshTunnel *t) { if (0 != t->dest) { @@ -1972,12 +1968,12 @@ peer_info_add_tunnel (struct MeshPeerInfo *p, struct MeshTunnel *t) /** * Remove a tunnel from the list of tunnels a peer participates in. * Free the tunnel's destination. - * + * * @param p Peer to clean. * @param t Tunnel to remove. */ static void -peer_info_remove_tunnel (struct MeshPeerInfo *p, struct MeshTunnel *t) +peer_remove_tunnel (struct MeshPeer *p, struct MeshTunnel *t) { unsigned int i; @@ -2038,7 +2034,7 @@ tunnel_poll (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_break (0); return; } - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " *** peer: %s!\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " *** peer: %s!\n", GNUNET_i2s(GNUNET_PEER_resolve2 (peer))); if (0 == peer) { @@ -2163,13 +2159,13 @@ path_add_to_peers (struct MeshPeerPath *p, int confirmed) for (i = 0; i < p->length && p->peers[i] != myid; i++) /* skip'em */ ; for (i++; i < p->length; i++) { - struct MeshPeerInfo *aux; + struct MeshPeer *aux; struct MeshPeerPath *copy; aux = peer_get_short (p->peers[i]); copy = path_duplicate (p); copy->length = i + 1; - peer_info_add_path (aux, copy, p->length < 3 ? GNUNET_NO : confirmed); + peer_add_path (aux, copy, p->length < 3 ? GNUNET_NO : confirmed); } } @@ -2278,7 +2274,7 @@ tunnel_change_state (struct MeshTunnel *t, enum MeshTunnelState state) /** * Add a client to a tunnel, initializing all needed data structures. - * + * * @param t Tunnel to which add the client. * @param c Client which to add to the tunnel. */ @@ -2372,13 +2368,13 @@ tunnel_notify_connection_broken (struct MeshTunnel *t, GNUNET_PEER_Id p1, // { // return; // } -// +// // if (tree_get_predecessor (t->tree) != 0) // { // /* We are the peer still connected, notify owner of the disconnection. */ // struct GNUNET_MESH_PathBroken msg; // struct GNUNET_PeerIdentity neighbor; -// +// // msg.header.size = htons (sizeof (msg)); // msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_PATH_BROKEN); // GNUNET_PEER_resolve (t->id.oid, &msg.oid); @@ -2394,7 +2390,7 @@ tunnel_notify_connection_broken (struct MeshTunnel *t, GNUNET_PEER_Id p1, /** * Send an end-to-end FWD ACK message for the most recent in-sequence payload. - * + * * @param t Tunnel this is about. * @param fwd Is for FWD traffic? (ACK dest->owner) */ @@ -2451,7 +2447,7 @@ tunnel_send_data_ack (struct MeshTunnel *t, int fwd) * If buffering is on, send when sent to children and buffer space is free. * Note that although the name is fwd_ack, the FWD mean forward *traffic*, * the ACK itself goes "back" (towards root). - * + * * @param t Tunnel on which to send the ACK. * @param type Type of message that triggered the ACK transmission. * @param fwd Is this FWD ACK? (Going dest->owner) @@ -2522,7 +2518,7 @@ tunnel_send_ack (struct MeshTunnel *t, uint16_t type, int fwd) delta_mid = rel->mid_sent - rel->head_sent->mid; else delta_mid = 0; - if (0 > delta || (GNUNET_YES == t->reliable && + if (0 > delta || (GNUNET_YES == t->reliable && NULL != o && (10 < rel->n_sent || 64 <= delta_mid))) delta = 0; @@ -2553,7 +2549,7 @@ tunnel_send_ack (struct MeshTunnel *t, uint16_t type, int fwd) /** * Modify the mesh message TID from global to local and send to client. - * + * * @param t Tunnel on which to send the message. * @param msg Message to modify and send. * @param c Client to send to. @@ -2589,7 +2585,7 @@ tunnel_send_client_to_tid (struct MeshTunnel *t, /** * Modify the unicast message TID from global to local and send to client. - * + * * @param t Tunnel on which to send the message. * @param msg Message to modify and send. * @param fwd Forward? @@ -2608,7 +2604,7 @@ tunnel_send_client_data (struct MeshTunnel *t, /** * Send up to 64 buffered messages to the client for in order delivery. - * + * * @param t Tunnel on which to empty the message buffer. * @param c Client to send to. * @param rel Reliability structure to corresponding peer. @@ -2654,7 +2650,7 @@ tunnel_send_client_buffered_data (struct MeshTunnel *t, struct MeshClient *c, /** * We have received a message out of order, buffer it until we receive * the missing one and we can feed the rest to the client. - * + * * @param t Tunnel to add to. * @param msg Message to buffer. * @param rel Reliability data to the corresponding direction. @@ -2701,7 +2697,7 @@ tunnel_add_buffered_data (struct MeshTunnel *t, * Destroy a reliable message after it has been acknowledged, either by * direct mid ACK or bitfield. Updates the appropriate data structures and * timers and frees all memory. - * + * * @param copy Message that is no longer needed: remote peer got it. */ static void @@ -2712,9 +2708,9 @@ tunnel_free_reliable_message (struct MeshReliableMessage *copy) rel = copy->rel; time = GNUNET_TIME_absolute_get_duration (copy->timestamp); - rel->expected_delay.rel_value *= 7; - rel->expected_delay.rel_value += time.rel_value; - rel->expected_delay.rel_value /= 8; + rel->expected_delay.rel_value_us *= 7; + rel->expected_delay.rel_value_us += time.rel_value_us; + rel->expected_delay.rel_value_us /= 8; rel->n_sent--; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! Freeing %u\n", copy->mid); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " n_sent %u\n", rel->n_sent); @@ -2850,7 +2846,7 @@ tunnel_retransmit_message (void *cls, struct MeshReliableMessage *copy; struct MeshFlowControl *fc; struct MeshPeerQueue *q; - struct MeshPeerInfo *pi; + struct MeshPeer *pi; struct MeshTunnel *t; struct GNUNET_MESH_Data *payload; GNUNET_PEER_Id hop; @@ -2939,10 +2935,10 @@ tunnel_keepalive (struct MeshTunnel *t, int fwd) /** - * Send keepalive packets for a tunnel. + * Send create (PATH_CREATE/PATH_ACK) packets for a tunnel. * - * @param cls Closure (tunnel for which to send the keepalive). - * @param tc Notification context. + * @param t Tunnel for which to send the message. + * @param fwd If GNUNET_YES, send CREATE, otherwise send ACK. */ static void tunnel_recreate (struct MeshTunnel *t, int fwd) @@ -2963,7 +2959,7 @@ tunnel_recreate (struct MeshTunnel *t, int fwd) * appropriate message (build or keepalive) * * @param t Tunnel to maintain. - * @param fw Is FWD? + * @param fwd Is FWD? */ static void tunnel_maintain (struct MeshTunnel *t, int fwd) @@ -3115,7 +3111,7 @@ tunnel_destroy (struct MeshTunnel *t) GNUNET_break (0); r = GNUNET_SYSERR; } - if (GNUNET_YES != + if (GNUNET_YES != GNUNET_CONTAINER_multihashmap32_remove (incoming_tunnels, t->local_tid_dest, t)) { @@ -3150,7 +3146,7 @@ tunnel_destroy (struct MeshTunnel *t) t->prev_fc.poll_task = GNUNET_SCHEDULER_NO_TASK; } if (0 != t->dest) { - peer_info_remove_tunnel (peer_get_short (t->dest), t); + peer_remove_tunnel (peer_get_short (t->dest), t); } if (GNUNET_SCHEDULER_NO_TASK != t->fwd_maintenance_task) @@ -3167,10 +3163,10 @@ tunnel_destroy (struct MeshTunnel *t) /** * Tunnel is empty: destroy it. - * + * * Notifies all participants (peers, cleints) about the destruction. - * - * @param t Tunnel to destroy. + * + * @param t Tunnel to destroy. */ static void tunnel_destroy_empty (struct MeshTunnel *t) @@ -3196,7 +3192,7 @@ tunnel_destroy_empty (struct MeshTunnel *t) /** * Initialize a Flow Control structure to the initial state. - * + * * @param fc Flow Control structure to initialize. */ static void @@ -3213,12 +3209,12 @@ fc_init (struct MeshFlowControl *fc) /** * Create a new tunnel - * + * * @param owner Who is the owner of the tunnel (short ID). * @param tid Tunnel Number of the tunnel. * @param client Clients that owns the tunnel, NULL for foreign tunnels. * @param local Tunnel Number for the tunnel, for the client point of view. - * + * * @return A new initialized tunnel. NULL on error. */ static struct MeshTunnel * @@ -3281,7 +3277,7 @@ tunnel_new (GNUNET_PEER_Id owner, /** * Set options in a tunnel, extracted from a bit flag field - * + * * @param t Tunnel to set options to. * @param options Bit array in host byte order. */ @@ -3542,7 +3538,7 @@ queue_destroy (struct MeshPeerQueue *queue, int clear_cls) * NULL when there are no transmittable messages. */ struct MeshPeerQueue * -queue_get_next (const struct MeshPeerInfo *peer) +queue_get_next (const struct MeshPeer *peer) { struct MeshPeerQueue *q; @@ -3597,7 +3593,7 @@ queue_get_next (const struct MeshPeerInfo *peer) static size_t queue_send (void *cls, size_t size, void *buf) { - struct MeshPeerInfo *peer = cls; + struct MeshPeer *peer = cls; struct GNUNET_MessageHeader *msg; struct MeshPeerQueue *queue; struct MeshTunnel *t; @@ -3610,6 +3606,12 @@ queue_send (void *cls, size_t size, void *buf) peer->core_transmit = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* Queue send\n"); + + if (NULL == buf || 0 == size) + { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* Buffer size 0.\n"); + return 0; + } queue = queue_get_next (peer); /* Queue has no internal mesh traffic nor sendable payload */ @@ -3620,6 +3622,7 @@ queue_send (void *cls, size_t size, void *buf) GNUNET_break (0); /* Core tmt_rdy should've been canceled */ return 0; } + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* not empty\n"); GNUNET_PEER_resolve (peer->id, &dst_id); @@ -3726,19 +3729,23 @@ queue_send (void *cls, size_t size, void *buf) queue = queue_get_next (peer); if (NULL != queue) { - struct GNUNET_PeerIdentity id; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* more data!\n"); - GNUNET_PEER_resolve (peer->id, &id); - peer->core_transmit = - GNUNET_CORE_notify_transmit_ready(core_handle, - 0, - 0, - GNUNET_TIME_UNIT_FOREVER_REL, - &id, - queue->size, - &queue_send, - peer); + if (NULL == peer->core_transmit) { + peer->core_transmit = + GNUNET_CORE_notify_transmit_ready(core_handle, + 0, + 0, + GNUNET_TIME_UNIT_FOREVER_REL, + &dst_id, + queue->size, + &queue_send, + peer); + } + else + { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "* tmt rdy called somewhere else\n"); + } } if (peer->id == t->next_hop) fc = &t->next_fc; @@ -3782,12 +3789,12 @@ queue_send (void *cls, size_t size, void *buf) /** * @brief Queue and pass message to core when possible. - * + * * If type is payload (UNICAST, TO_ORIGIN) checks for queue status and * accounts for it. In case the queue is full, the message is dropped and * a break issued. - * - * Otherwise, message is treated as internal and allowed to go regardless of + * + * Otherwise, message is treated as internal and allowed to go regardless of * queue status. * * @param cls Closure (@c type dependant). It will be used by queue_send to @@ -3799,10 +3806,9 @@ queue_send (void *cls, size_t size, void *buf) */ static void queue_add (void *cls, uint16_t type, size_t size, - struct MeshPeerInfo *dst, struct MeshTunnel *t) + struct MeshPeer *dst, struct MeshTunnel *t) { struct MeshPeerQueue *queue; - struct GNUNET_PeerIdentity id; struct MeshFlowControl *fc; int priority; @@ -3869,16 +3875,15 @@ queue_add (void *cls, uint16_t type, size_t size, } else GNUNET_CONTAINER_DLL_insert_tail (dst->queue_head, dst->queue_tail, queue); - + if (NULL == dst->core_transmit) { - GNUNET_PEER_resolve (dst->id, &id); dst->core_transmit = GNUNET_CORE_notify_transmit_ready (core_handle, 0, 0, GNUNET_TIME_UNIT_FOREVER_REL, - &id, + GNUNET_PEER_resolve2 (dst->id), size, &queue_send, dst); @@ -3913,8 +3918,8 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MESH_CreateTunnel *msg; struct GNUNET_PeerIdentity *pi; struct MeshPeerPath *path; - struct MeshPeerInfo *dest_peer_info; - struct MeshPeerInfo *orig_peer_info; + struct MeshPeer *dest_peer_info; + struct MeshPeer *orig_peer_info; struct MeshTunnel *t; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -3975,25 +3980,25 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer, tunnel_reset_timeout (t, GNUNET_YES); tunnel_change_state (t, MESH_TUNNEL_WAITING); dest_peer_info = - GNUNET_CONTAINER_multihashmap_get (peers, &pi[size - 1].hashPubKey); + GNUNET_CONTAINER_multipeermap_get (peers, &pi[size - 1]); if (NULL == dest_peer_info) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Creating PeerInfo for destination.\n"); - dest_peer_info = GNUNET_malloc (sizeof (struct MeshPeerInfo)); + dest_peer_info = GNUNET_malloc (sizeof (struct MeshPeer)); dest_peer_info->id = GNUNET_PEER_intern (&pi[size - 1]); - GNUNET_CONTAINER_multihashmap_put (peers, &pi[size - 1].hashPubKey, + GNUNET_CONTAINER_multipeermap_put (peers, &pi[size - 1], dest_peer_info, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); } - orig_peer_info = GNUNET_CONTAINER_multihashmap_get (peers, &pi->hashPubKey); + orig_peer_info = GNUNET_CONTAINER_multipeermap_get (peers, pi); if (NULL == orig_peer_info) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Creating PeerInfo for origin.\n"); - orig_peer_info = GNUNET_malloc (sizeof (struct MeshPeerInfo)); + orig_peer_info = GNUNET_new (struct MeshPeer); orig_peer_info->id = GNUNET_PEER_intern (pi); - GNUNET_CONTAINER_multihashmap_put (peers, &pi->hashPubKey, orig_peer_info, + GNUNET_CONTAINER_multipeermap_put (peers, pi, orig_peer_info, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Creating path...\n"); @@ -4019,7 +4024,7 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer, path_add_to_peers (path, GNUNET_NO); tunnel_use_path (t, path); - peer_info_add_tunnel (dest_peer_info, t); + peer_add_tunnel (dest_peer_info, t); if (own_pos == size - 1) { @@ -4034,29 +4039,33 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer, } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " It's for us!\n"); - peer_info_add_path_to_origin (orig_peer_info, path, GNUNET_YES); + peer_add_path_to_origin (orig_peer_info, path, GNUNET_YES); + /* This can be a retransmission due to a lost PATH ACK. + * Check if we already have a destination client for the tunnel. */ + if (t->client != c) + { + /* Assign local tid */ + while (NULL != tunnel_get_incoming (next_local_tid)) + next_local_tid = (next_local_tid + 1) | GNUNET_MESH_LOCAL_TUNNEL_ID_SERV; + t->local_tid_dest = next_local_tid++; + next_local_tid = next_local_tid | GNUNET_MESH_LOCAL_TUNNEL_ID_SERV; - /* Assign local tid */ - while (NULL != tunnel_get_incoming (next_local_tid)) - next_local_tid = (next_local_tid + 1) | GNUNET_MESH_LOCAL_TUNNEL_ID_SERV; - t->local_tid_dest = next_local_tid++; - next_local_tid = next_local_tid | GNUNET_MESH_LOCAL_TUNNEL_ID_SERV; + if (GNUNET_YES == t->reliable) + { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! Reliable\n"); + t->bck_rel = GNUNET_malloc (sizeof (struct MeshTunnelReliability)); + t->bck_rel->t = t; + t->bck_rel->expected_delay = MESH_RETRANSMIT_TIME; + } - if (GNUNET_YES == t->reliable) - { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! Reliable\n"); - t->bck_rel = GNUNET_malloc (sizeof (struct MeshTunnelReliability)); - t->bck_rel->t = t; - t->bck_rel->expected_delay = MESH_RETRANSMIT_TIME; + tunnel_add_client (t, c); + send_local_tunnel_create (t); } - - tunnel_add_client (t, c); - send_local_tunnel_create (t); send_path_ack (t); /* Eliminate tunnel when origin dies */ tunnel_reset_timeout (t, GNUNET_YES); /* Keep tunnel alive in direction dest->owner*/ - tunnel_reset_timeout (t, GNUNET_NO); + tunnel_reset_timeout (t, GNUNET_NO); } else { @@ -4068,8 +4077,8 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer, /* It's for somebody else! Retransmit. */ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Retransmitting.\n"); path2 = path_duplicate (path); - peer_info_add_path (dest_peer_info, path2, GNUNET_NO); - peer_info_add_path_to_origin (orig_peer_info, path, GNUNET_NO); + peer_add_path (dest_peer_info, path2, GNUNET_NO); + peer_add_path_to_origin (orig_peer_info, path, GNUNET_NO); send_path_create (t); } return GNUNET_OK; @@ -4092,7 +4101,7 @@ handle_mesh_path_ack (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message) { struct GNUNET_MESH_PathACK *msg; - struct MeshPeerInfo *peer_info; + struct MeshPeer *peer_info; struct MeshPeerPath *p; struct MeshTunnel *t; @@ -4662,7 +4671,7 @@ handle_mesh_poll (void *cls, const struct GNUNET_PeerIdentity *peer, uint32_t pid; uint32_t old; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got an POLL packet from %s!\n", + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got a POLL packet from %s!\n", GNUNET_i2s (peer)); msg = (struct GNUNET_MESH_Poll *) message; @@ -4744,7 +4753,7 @@ handle_mesh_keepalive (void *cls, const struct GNUNET_PeerIdentity *peer, return GNUNET_OK; } - fwd = GNUNET_MESSAGE_TYPE_MESH_FWD_KEEPALIVE == ntohs (message->type) ? + fwd = GNUNET_MESSAGE_TYPE_MESH_FWD_KEEPALIVE == ntohs (message->type) ? GNUNET_YES : GNUNET_NO; c = fwd ? t->client : t->owner; hop = fwd ? t->next_hop : t->prev_hop; @@ -4816,7 +4825,7 @@ dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp, unsigned int put_path_length, enum GNUNET_BLOCK_Type type, size_t size, const void *data) { - struct MeshPeerInfo *peer = cls; + struct MeshPeer *peer = cls; struct MeshPeerPath *p; struct GNUNET_PeerIdentity pi; int i; @@ -4836,7 +4845,7 @@ dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp, GNUNET_PEER_resolve (peer->tunnels[i]->id.oid, &id); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " ... tunnel %s:%X (%X / %X)\n", GNUNET_i2s (&id), peer->tunnels[i]->id.tid, - peer->tunnels[i]->local_tid, + peer->tunnels[i]->local_tid, peer->tunnels[i]->local_tid_dest); if (peer->tunnels[i]->state == MESH_TUNNEL_SEARCHING) { @@ -4886,7 +4895,6 @@ static void handle_local_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client) { struct MeshClient *c; - struct MeshClient *next; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "client disconnected: %p\n", client); if (client == NULL) @@ -4922,12 +4930,10 @@ handle_local_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client) &client_release_ports, c); GNUNET_CONTAINER_multihashmap32_destroy (c->ports); } - next = c->next; GNUNET_CONTAINER_DLL_remove (clients_head, clients_tail, c); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " client free (%p)\n", c); GNUNET_free (c); GNUNET_STATISTICS_update (stats, "# clients", -1, GNUNET_NO); - c = next; } else { @@ -5017,7 +5023,7 @@ handle_local_tunnel_create (void *cls, struct GNUNET_SERVER_Client *client, const struct GNUNET_MessageHeader *message) { struct GNUNET_MESH_TunnelMessage *t_msg; - struct MeshPeerInfo *peer_info; + struct MeshPeer *peer_info; struct MeshTunnel *t; struct MeshClient *c; MESH_TunnelNumber tid; @@ -5078,7 +5084,7 @@ handle_local_tunnel_create (void *cls, struct GNUNET_SERVER_Client *client, GNUNET_i2s (&my_full_id), t->id.tid, t->port, t->local_tid); peer_info = peer_get (&t_msg->peer); - peer_info_add_tunnel (peer_info, t); + peer_add_tunnel (peer_info, t); peer_connect (peer_info, t); tunnel_reset_timeout (t, GNUNET_YES); GNUNET_SERVER_receive_done (client, GNUNET_OK); @@ -5143,10 +5149,10 @@ handle_local_tunnel_destroy (void *cls, struct GNUNET_SERVER_Client *client, } else if (c == t->owner && GNUNET_MESH_LOCAL_TUNNEL_ID_SERV > tid) { - peer_info_remove_tunnel (peer_get_short (t->dest), t); + peer_remove_tunnel (peer_get_short (t->dest), t); t->owner = NULL; } - else + else { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, " tunnel %X client %p (%p, %p)\n", @@ -5219,7 +5225,7 @@ handle_local_data (void *cls, struct GNUNET_SERVER_Client *client, t->owner->handle == client) || (tid >= GNUNET_MESH_LOCAL_TUNNEL_ID_SERV && - t->client && + t->client && t->client->handle == client) ) ) { GNUNET_break (0); @@ -5519,7 +5525,7 @@ static struct GNUNET_SERVER_MessageHandler client_handlers[] = { static void core_connect (void *cls, const struct GNUNET_PeerIdentity *peer) { - struct MeshPeerInfo *peer_info; + struct MeshPeer *peer_info; struct MeshPeerPath *path; DEBUG_CONN ("Peer connected\n"); @@ -5540,7 +5546,7 @@ core_connect (void *cls, const struct GNUNET_PeerIdentity *peer) } path->peers[0] = myid; GNUNET_PEER_change_rc (myid, 1); - peer_info_add_path (peer_info, path, GNUNET_YES); + peer_add_path (peer_info, path, GNUNET_YES); return; } @@ -5554,12 +5560,12 @@ core_connect (void *cls, const struct GNUNET_PeerIdentity *peer) static void core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) { - struct MeshPeerInfo *pi; + struct MeshPeer *pi; struct MeshPeerQueue *q; struct MeshPeerQueue *n; DEBUG_CONN ("Peer disconnected\n"); - pi = GNUNET_CONTAINER_multihashmap_get (peers, &peer->hashPubKey); + pi = GNUNET_CONTAINER_multipeermap_get (peers, peer); if (NULL == pi) { GNUNET_break (0); @@ -5578,7 +5584,7 @@ core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) GNUNET_CORE_notify_transmit_ready_cancel(pi->core_transmit); pi->core_transmit = NULL; } - peer_info_remove_path (pi, pi->id, myid); + peer_remove_path (pi, pi->id, myid); if (myid == pi->id) { DEBUG_CONN (" (self)\n"); @@ -5612,20 +5618,17 @@ server_init (void) * To be called on core init/fail. * * @param cls Closure (config) - * @param server handle to the server for this service * @param identity the public identity of this peer */ static void -core_init (void *cls, struct GNUNET_CORE_Handle *server, +core_init (void *cls, const struct GNUNET_PeerIdentity *identity) { const struct GNUNET_CONFIGURATION_Handle *c = cls; static int i = 0; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Core init\n"); - GNUNET_break (core_handle == server); - if (0 != memcmp (identity, &my_full_id, sizeof (my_full_id)) || - NULL == server) + if (0 != memcmp (identity, &my_full_id, sizeof (my_full_id))) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Wrong CORE service\n")); GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -5685,9 +5688,9 @@ shutdown_tunnel (void *cls, const struct GNUNET_HashCode * key, void *value) * GNUNET_NO if not. */ static int -shutdown_peer (void *cls, const struct GNUNET_HashCode * key, void *value) +shutdown_peer (void *cls, const struct GNUNET_PeerIdentity *key, void *value) { - struct MeshPeerInfo *p = value; + struct MeshPeer *p = value; struct MeshPeerQueue *q; struct MeshPeerQueue *n; @@ -5701,7 +5704,7 @@ shutdown_peer (void *cls, const struct GNUNET_HashCode * key, void *value) } q = n; } - peer_info_destroy (p); + peer_destroy (p); return GNUNET_YES; } @@ -5723,7 +5726,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) core_handle = NULL; } GNUNET_CONTAINER_multihashmap_iterate (tunnels, &shutdown_tunnel, NULL); - GNUNET_CONTAINER_multihashmap_iterate (peers, &shutdown_peer, NULL); + GNUNET_CONTAINER_multipeermap_iterate (peers, &shutdown_peer, NULL); if (dht_handle != NULL) { GNUNET_DHT_disconnect (dht_handle); @@ -5755,7 +5758,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, const struct GNUNET_CONFIGURATION_Handle *c) { char *keyfile; - struct GNUNET_CRYPTO_EccPrivateKey *pk; + struct GNUNET_CRYPTO_EddsaPrivateKey *pk; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "starting to run\n"); server_handle = server; @@ -5881,7 +5884,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, tunnels = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_NO); incoming_tunnels = GNUNET_CONTAINER_multihashmap32_create (32); - peers = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_NO); + peers = GNUNET_CONTAINER_multipeermap_create (32, GNUNET_NO); ports = GNUNET_CONTAINER_multihashmap32_create (32); dht_handle = GNUNET_DHT_connect (c, 64); @@ -5894,13 +5897,12 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, /* Scheduled the task to clean up when shutdown is called */ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, NULL); - pk = GNUNET_CRYPTO_ecc_key_create_from_file (keyfile); + pk = GNUNET_CRYPTO_eddsa_key_create_from_file (keyfile); GNUNET_free (keyfile); GNUNET_assert (NULL != pk); my_private_key = pk; - GNUNET_CRYPTO_ecc_key_get_public (my_private_key, &my_public_key); - GNUNET_CRYPTO_hash (&my_public_key, sizeof (my_public_key), - &my_full_id.hashPubKey); + GNUNET_CRYPTO_eddsa_key_get_public (my_private_key, + &my_full_id.public_key); myid = GNUNET_PEER_intern (&my_full_id); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Mesh for peer [%s] starting\n",