From 90c70e8315c4a366996da379f839dc84d21d5f38 Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Wed, 20 Jul 2016 17:13:26 +0000 Subject: - fix CADET-using services --- src/conversation/gnunet-service-conversation.c | 32 ++++++++++++---------- src/exit/gnunet-daemon-exit.c | 16 +++++++---- src/fs/gnunet-service-fs_cadet_client.c | 8 ++---- src/fs/gnunet-service-fs_cadet_server.c | 20 ++++++-------- src/multicast/gnunet-service-multicast.c | 16 ++++------- src/pt/gnunet-daemon-pt.c | 6 ++-- src/rps/gnunet-service-rps.c | 9 +++--- src/rps/gnunet-service-rps_peers.c | 14 +++++----- src/rps/gnunet-service-rps_peers.h | 6 ++-- .../gnunet-service-scalarproduct-ecc_alice.c | 6 ++-- .../gnunet-service-scalarproduct-ecc_bob.c | 13 ++++----- .../gnunet-service-scalarproduct_alice.c | 6 ++-- .../gnunet-service-scalarproduct_bob.c | 13 ++++----- src/set/gnunet-service-set.c | 14 +++++----- src/vpn/gnunet-service-vpn.c | 9 +++--- 15 files changed, 88 insertions(+), 100 deletions(-) diff --git a/src/conversation/gnunet-service-conversation.c b/src/conversation/gnunet-service-conversation.c index dcef0f18b..b547d814c 100644 --- a/src/conversation/gnunet-service-conversation.c +++ b/src/conversation/gnunet-service-conversation.c @@ -720,7 +720,7 @@ handle_client_call_message (void *cls, ch->channel_reliable = GNUNET_CADET_channel_create (cadet, ch, &msg->target, - GNUNET_APPLICATION_TYPE_CONVERSATION_CONTROL, + GC_u2h (GNUNET_APPLICATION_TYPE_CONVERSATION_CONTROL), GNUNET_CADET_OPTION_RELIABLE); ch->reliable_mq = GNUNET_CADET_mq_create (ch->channel_reliable); e = GNUNET_MQ_msg (ring, GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING); @@ -1102,7 +1102,7 @@ handle_cadet_pickup_message (void *cls, ch->channel_unreliable = GNUNET_CADET_channel_create (cadet, ch, &ch->target, - GNUNET_APPLICATION_TYPE_CONVERSATION_AUDIO, + GC_u2h (GNUNET_APPLICATION_TYPE_CONVERSATION_AUDIO), GNUNET_CADET_OPTION_DEFAULT); if (NULL == ch->channel_unreliable) { @@ -1351,13 +1351,14 @@ handle_cadet_audio_message (void *cls, */ static void * inbound_channel (void *cls, - struct GNUNET_CADET_Channel *channel, - const struct GNUNET_PeerIdentity *initiator, - uint32_t port, enum GNUNET_CADET_ChannelOption options) + struct GNUNET_CADET_Channel *channel, + const struct GNUNET_PeerIdentity *initiator, + const struct GNUNET_HashCode *port, + enum GNUNET_CADET_ChannelOption options) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, - _("Received incoming Cadet channel on port %u\n"), - (unsigned int) port); + _("Received incoming Cadet channel on port %s\n"), + GNUNET_h2s (port)); return NULL; } @@ -1557,11 +1558,6 @@ run (void *cls, 0}, {NULL, 0, 0} }; - static uint32_t ports[] = { - GNUNET_APPLICATION_TYPE_CONVERSATION_CONTROL, - GNUNET_APPLICATION_TYPE_CONVERSATION_AUDIO, - 0 - }; cfg = c; GNUNET_assert (GNUNET_OK == @@ -1569,10 +1565,8 @@ run (void *cls, &my_identity)); cadet = GNUNET_CADET_connect (cfg, NULL, - &inbound_channel, &inbound_end, - cadet_handlers, - ports); + cadet_handlers); if (NULL == cadet) { @@ -1580,6 +1574,14 @@ run (void *cls, GNUNET_SCHEDULER_shutdown (); return; } + + GNUNET_CADET_open_port (cadet, + GC_u2h (GNUNET_APPLICATION_TYPE_CONVERSATION_CONTROL), + &inbound_channel, NULL); + GNUNET_CADET_open_port (cadet, + GC_u2h (GNUNET_APPLICATION_TYPE_CONVERSATION_AUDIO), + &inbound_channel, NULL); + nc = GNUNET_SERVER_notification_context_create (server, 16); GNUNET_SERVER_add_handlers (server, server_handlers); GNUNET_SERVER_disconnect_notify (server, diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c index 9f3d05c77..2b9ddc722 100644 --- a/src/exit/gnunet-daemon-exit.c +++ b/src/exit/gnunet-daemon-exit.c @@ -3036,7 +3036,7 @@ static void * new_channel (void *cls, struct GNUNET_CADET_Channel *channel, const struct GNUNET_PeerIdentity *initiator, - uint32_t port, + const struct GNUNET_HashCode *port, enum GNUNET_CADET_ChannelOption options) { struct ChannelState *s = GNUNET_new (struct ChannelState); @@ -3760,16 +3760,20 @@ run (void *cls, GNUNET_SCHEDULER_shutdown (); return; } - cadet_handle - = GNUNET_CADET_connect (cfg, NULL, - &new_channel, - &clean_channel, handlers, - apptypes); + cadet_handle = GNUNET_CADET_connect (cfg, NULL, &clean_channel, handlers); if (NULL == cadet_handle) { GNUNET_SCHEDULER_shutdown (); return; } + for (int i = 0; + GNUNET_APPLICATION_TYPE_END != apptypes[i] + && i < sizeof (apptypes)/sizeof (*apptypes); + i++) + { + GNUNET_CADET_open_port (cadet_handle, GC_u2h (apptypes[i]), + &new_channel, NULL); + } /* Cadet handle acquired, now announce regular expressions matching our exit */ if ( (GNUNET_YES == ipv4_enabled) && (GNUNET_YES == ipv4_exit) ) diff --git a/src/fs/gnunet-service-fs_cadet_client.c b/src/fs/gnunet-service-fs_cadet_client.c index 90a0c3b7f..5b24b3116 100644 --- a/src/fs/gnunet-service-fs_cadet_client.c +++ b/src/fs/gnunet-service-fs_cadet_client.c @@ -236,7 +236,7 @@ reset_cadet (struct CadetHandle *mh) mh->channel = GNUNET_CADET_channel_create (cadet_handle, mh, &mh->target, - GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER, + GC_u2h (GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER), GNUNET_CADET_OPTION_RELIABLE); transmit_pending (mh); } @@ -547,7 +547,7 @@ get_cadet (const struct GNUNET_PeerIdentity *target) mh->channel = GNUNET_CADET_channel_create (cadet_handle, mh, &mh->target, - GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER, + GC_u2h (GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER), GNUNET_CADET_OPTION_RELIABLE); GNUNET_assert (mh == GNUNET_CONTAINER_multipeermap_get (cadet_map, @@ -718,11 +718,9 @@ GSF_cadet_start_client () cadet_map = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_YES); cadet_handle = GNUNET_CADET_connect (GSF_cfg, - NULL, NULL, &cleaner_cb, - handlers, - NULL); + handlers); } diff --git a/src/fs/gnunet-service-fs_cadet_server.c b/src/fs/gnunet-service-fs_cadet_server.c index 21874b674..32fe4191a 100644 --- a/src/fs/gnunet-service-fs_cadet_server.c +++ b/src/fs/gnunet-service-fs_cadet_server.c @@ -472,7 +472,8 @@ static void * accept_cb (void *cls, struct GNUNET_CADET_Channel *channel, const struct GNUNET_PeerIdentity *initiator, - uint32_t port, enum GNUNET_CADET_ChannelOption options) + const struct GNUNET_HashCode *port, + enum GNUNET_CADET_ChannelOption options) { struct CadetClient *sc; @@ -561,11 +562,6 @@ GSF_cadet_start_server () { &request_cb, GNUNET_MESSAGE_TYPE_FS_CADET_QUERY, sizeof (struct CadetQueryMessage)}, { NULL, 0, 0 } }; - static const uint32_t ports[] = { - GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER, - 0 - }; - if (GNUNET_YES != GNUNET_CONFIGURATION_get_value_number (GSF_cfg, "fs", @@ -576,11 +572,13 @@ GSF_cadet_start_server () "Initializing cadet FS server with a limit of %llu connections\n", sc_count_max); listen_channel = GNUNET_CADET_connect (GSF_cfg, - NULL, - &accept_cb, - &cleaner_cb, - handlers, - ports); + NULL, + &cleaner_cb, + handlers); + GNUNET_assert (NULL != listen_channel); + GNUNET_CADET_open_port (listen_channel, + GC_u2h (GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER), + &accept_cb, NULL); } diff --git a/src/multicast/gnunet-service-multicast.c b/src/multicast/gnunet-service-multicast.c index 55c269874..91cafb707 100644 --- a/src/multicast/gnunet-service-multicast.c +++ b/src/multicast/gnunet-service-multicast.c @@ -789,7 +789,7 @@ cadet_channel_create (struct Group *grp, struct GNUNET_PeerIdentity *peer) chn->direction = DIR_OUTGOING; chn->join_status = JOIN_WAITING; chn->channel = GNUNET_CADET_channel_create (cadet, chn, &chn->peer, - GNUNET_APPLICATION_TYPE_MULTICAST, + GC_u2h (GNUNET_APPLICATION_TYPE_MULTICAST), GNUNET_CADET_OPTION_RELIABLE); GNUNET_CONTAINER_multihashmap_put (channels_out, &chn->group_pub_hash, chn, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); @@ -1484,7 +1484,7 @@ static void * cadet_notify_channel_new (void *cls, struct GNUNET_CADET_Channel *channel, const struct GNUNET_PeerIdentity *initiator, - uint32_t port, + const struct GNUNET_HashCode *port, enum GNUNET_CADET_ChannelOption options) { return NULL; @@ -1809,12 +1809,6 @@ static const struct GNUNET_CADET_MessageHandler cadet_handlers[] = { }; -/** - * Listening ports for CADET. - */ -static const uint32_t cadet_ports[] = { GNUNET_APPLICATION_TYPE_MULTICAST, 0 }; - - /** * Connected to core service. */ @@ -1833,9 +1827,11 @@ core_connected_cb (void *cls, const struct GNUNET_PeerIdentity *my_identity) replay_req_client = GNUNET_CONTAINER_multihashmap_create (1, GNUNET_NO); cadet = GNUNET_CADET_connect (cfg, NULL, - &cadet_notify_channel_new, &cadet_notify_channel_end, - cadet_handlers, cadet_ports); + cadet_handlers); + GNUNET_assert (NULL != cadet); + GNUNET_CADET_open_port (cadet, GC_u2h (GNUNET_APPLICATION_TYPE_MULTICAST), + &cadet_notify_channel_new, NULL); nc = GNUNET_SERVER_notification_context_create (server, 1); GNUNET_SERVER_add_handlers (server, server_handlers); diff --git a/src/pt/gnunet-daemon-pt.c b/src/pt/gnunet-daemon-pt.c index 5d83fd883..7f4852e4b 100644 --- a/src/pt/gnunet-daemon-pt.c +++ b/src/pt/gnunet-daemon-pt.c @@ -351,7 +351,7 @@ try_open_exit () pos->cadet_channel = GNUNET_CADET_channel_create (cadet_handle, pos, &pos->peer, - GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER, + GC_u2h (GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER), GNUNET_CADET_OPTION_DEFAULT); if (NULL == pos->cadet_channel) { @@ -1288,9 +1288,9 @@ run (void *cls, char *const *args GNUNET_UNUSED, GNUNET_SCHEDULER_shutdown (); return; } - cadet_handle = GNUNET_CADET_connect (cfg, NULL, NULL, + cadet_handle = GNUNET_CADET_connect (cfg, NULL, &cadet_channel_end_cb, - cadet_handlers, NULL); + cadet_handlers); if (NULL == cadet_handle) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index bb2bd0881..00c541d1f 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c @@ -2334,13 +2334,14 @@ run (void *cls, {&handle_peer_pull_reply , GNUNET_MESSAGE_TYPE_RPS_PP_PULL_REPLY , 0}, {NULL, 0, 0} }; - const uint32_t ports[] = {GNUNET_RPS_CADET_PORT, 0}; // _PORT specified in src/rps/rps.h cadet_handle = GNUNET_CADET_connect (cfg, cls, - &Peers_handle_inbound_channel, &cleanup_destroyed_channel, - cadet_handlers, - ports); + cadet_handlers); + GNUNET_assert (NULL != cadet_handle); + GNUNET_CADET_open_port (cadet_handle, GC_u2h (GNUNET_RPS_CADET_PORT), + &Peers_handle_inbound_channel, cls); + peerinfo_handle = GNUNET_PEERINFO_connect (cfg); Peers_initialise (fn_valid_peers, cadet_handle, &own_identity); diff --git a/src/rps/gnunet-service-rps_peers.c b/src/rps/gnunet-service-rps_peers.c index 2b5f39857..7c9f5ecd9 100644 --- a/src/rps/gnunet-service-rps_peers.c +++ b/src/rps/gnunet-service-rps_peers.c @@ -174,7 +174,7 @@ struct PeerContext * Identity of the peer */ struct GNUNET_PeerIdentity peer_id; - + /** * Flags indicating status of peer */ @@ -506,7 +506,7 @@ get_channel (const struct GNUNET_PeerIdentity *peer) GNUNET_CADET_channel_create (cadet_handle, peer_ctx->send_channel_flags, /* context */ peer, - GNUNET_RPS_CADET_PORT, + GC_u2h (GNUNET_RPS_CADET_PORT), GNUNET_CADET_OPTION_RELIABLE); } GNUNET_assert (NULL != peer_ctx->send_channel); @@ -518,7 +518,7 @@ get_channel (const struct GNUNET_PeerIdentity *peer) * * If we already have a message queue open to this client, * simply return it, otherways create one. - * + * * @param peer the peer to get the mq to * @return the #GNUNET_MQ_Handle */ @@ -1086,7 +1086,7 @@ Peers_clean_peer (const struct GNUNET_PeerIdentity *peer) // TODO actually remove unnecessary data - if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (peer_map, peer)) + if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (peer_map, peer)) { return GNUNET_NO; } @@ -1104,7 +1104,7 @@ Peers_clean_peer (const struct GNUNET_PeerIdentity *peer) /** * @brief Remove peer - * + * * @param peer the peer to clean * @return #GNUNET_YES if peer was removed * #GNUNET_NO otherwise @@ -1114,7 +1114,7 @@ Peers_remove_peer (const struct GNUNET_PeerIdentity *peer) { struct PeerContext *peer_ctx; - if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (peer_map, peer)) + if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (peer_map, peer)) { return GNUNET_NO; } @@ -1350,7 +1350,7 @@ void * Peers_handle_inbound_channel (void *cls, struct GNUNET_CADET_Channel *channel, const struct GNUNET_PeerIdentity *initiator, - uint32_t port, + const struct GNUNET_HashCode *port, enum GNUNET_CADET_ChannelOption options) { struct PeerContext *peer_ctx; diff --git a/src/rps/gnunet-service-rps_peers.h b/src/rps/gnunet-service-rps_peers.h index abb5d831a..c7b9ed265 100644 --- a/src/rps/gnunet-service-rps_peers.h +++ b/src/rps/gnunet-service-rps_peers.h @@ -173,7 +173,7 @@ Peers_issue_peer_liveliness_check (const struct GNUNET_PeerIdentity *peer); /** * @brief Remove unecessary data - * + * * If the other peer is not intending to send messages, we have messages pending * to be sent to this peer and we are not waiting for a reply, remove the * information about it (its #PeerContext). @@ -187,7 +187,7 @@ Peers_clean_peer (const struct GNUNET_PeerIdentity *peer); /** * @brief Remove peer - * + * * @param peer the peer to clean * @return #GNUNET_YES if peer was removed * #GNUNET_NO otherwise @@ -320,7 +320,7 @@ void * Peers_handle_inbound_channel (void *cls, struct GNUNET_CADET_Channel *channel, const struct GNUNET_PeerIdentity *initiator, - uint32_t port, + const struct GNUNET_HashCode *port, enum GNUNET_CADET_ChannelOption options); /** diff --git a/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c b/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c index c9f4811e2..43a25a08d 100644 --- a/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c +++ b/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c @@ -858,7 +858,7 @@ client_request_complete_alice (struct AliceServiceSession *s) = GNUNET_CADET_channel_create (my_cadet, s, &s->peer, - GNUNET_APPLICATION_TYPE_SCALARPRODUCT_ECC, + GC_u2h (GNUNET_APPLICATION_TYPE_SCALARPRODUCT_ECC), GNUNET_CADET_OPTION_RELIABLE); if (NULL == s->channel) { @@ -1184,10 +1184,8 @@ run (void *cls, &handle_client_disconnect, NULL); my_cadet = GNUNET_CADET_connect (cfg, NULL, - NULL /* no incoming supported */, &cb_channel_destruction, - cadet_handlers, - NULL); + cadet_handlers); if (NULL == my_cadet) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, diff --git a/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c b/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c index fbdf62192..7246fa6a0 100644 --- a/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c +++ b/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c @@ -891,7 +891,7 @@ static void * cb_channel_incoming (void *cls, struct GNUNET_CADET_Channel *channel, const struct GNUNET_PeerIdentity *initiator, - uint32_t port, + const struct GNUNET_HashCode *port, enum GNUNET_CADET_ChannelOption options) { struct CadetIncomingSession *in; @@ -1221,10 +1221,6 @@ run (void *cls, 0}, { NULL, 0, 0} }; - static const uint32_t ports[] = { - GNUNET_APPLICATION_TYPE_SCALARPRODUCT_ECC, - 0 - }; cfg = c; /* We don't really do DLOG, so we can setup with very minimal resources */ @@ -1241,10 +1237,8 @@ run (void *cls, cadet_sessions = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_YES); my_cadet = GNUNET_CADET_connect (cfg, NULL, - &cb_channel_incoming, &cb_channel_destruction, - cadet_handlers, - ports); + cadet_handlers); if (NULL == my_cadet) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -1252,6 +1246,9 @@ run (void *cls, GNUNET_SCHEDULER_shutdown (); return; } + GNUNET_CADET_open_port (my_cadet, + GC_u2h (GNUNET_APPLICATION_TYPE_SCALARPRODUCT_ECC), + &cb_channel_incoming, NULL); GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); } diff --git a/src/scalarproduct/gnunet-service-scalarproduct_alice.c b/src/scalarproduct/gnunet-service-scalarproduct_alice.c index 5478a85a7..8c3b1ed24 100644 --- a/src/scalarproduct/gnunet-service-scalarproduct_alice.c +++ b/src/scalarproduct/gnunet-service-scalarproduct_alice.c @@ -1081,7 +1081,7 @@ client_request_complete_alice (struct AliceServiceSession *s) = GNUNET_CADET_channel_create (my_cadet, s, &s->peer, - GNUNET_APPLICATION_TYPE_SCALARPRODUCT, + GC_u2h (GNUNET_APPLICATION_TYPE_SCALARPRODUCT), GNUNET_CADET_OPTION_RELIABLE); if (NULL == s->channel) { @@ -1409,10 +1409,8 @@ run (void *cls, &handle_client_disconnect, NULL); my_cadet = GNUNET_CADET_connect (cfg, NULL, - NULL /* no incoming supported */, &cb_channel_destruction, - cadet_handlers, - NULL); + cadet_handlers); if (NULL == my_cadet) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, diff --git a/src/scalarproduct/gnunet-service-scalarproduct_bob.c b/src/scalarproduct/gnunet-service-scalarproduct_bob.c index 5be0a85d1..84c831c82 100644 --- a/src/scalarproduct/gnunet-service-scalarproduct_bob.c +++ b/src/scalarproduct/gnunet-service-scalarproduct_bob.c @@ -1187,7 +1187,7 @@ static void * cb_channel_incoming (void *cls, struct GNUNET_CADET_Channel *channel, const struct GNUNET_PeerIdentity *initiator, - uint32_t port, + const struct GNUNET_HashCode *port, enum GNUNET_CADET_ChannelOption options) { struct CadetIncomingSession *in; @@ -1512,10 +1512,6 @@ run (void *cls, 0}, { NULL, 0, 0} }; - static const uint32_t ports[] = { - GNUNET_APPLICATION_TYPE_SCALARPRODUCT, - 0 - }; cfg = c; /* @@ -1538,10 +1534,8 @@ run (void *cls, cadet_sessions = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_YES); my_cadet = GNUNET_CADET_connect (cfg, NULL, - &cb_channel_incoming, &cb_channel_destruction, - cadet_handlers, - ports); + cadet_handlers); if (NULL == my_cadet) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -1549,6 +1543,9 @@ run (void *cls, GNUNET_SCHEDULER_shutdown (); return; } + GNUNET_CADET_open_port (my_cadet, + GC_u2h (GNUNET_APPLICATION_TYPE_SCALARPRODUCT), + &cb_channel_incoming, NULL); GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); } diff --git a/src/set/gnunet-service-set.c b/src/set/gnunet-service-set.c index a5baf8cfd..16f330a4d 100644 --- a/src/set/gnunet-service-set.c +++ b/src/set/gnunet-service-set.c @@ -1358,7 +1358,7 @@ handle_client_evaluate (void *cls, op->channel = GNUNET_CADET_channel_create (cadet, op, &msg->target_peer, - GNUNET_APPLICATION_TYPE_SET, + GC_u2h (GNUNET_APPLICATION_TYPE_SET), GNUNET_CADET_OPTION_RELIABLE); op->mq = GNUNET_CADET_mq_create (op->channel); set->vt->evaluate (op, @@ -1796,7 +1796,7 @@ static void * channel_new_cb (void *cls, struct GNUNET_CADET_Channel *channel, const struct GNUNET_PeerIdentity *initiator, - uint32_t port, + const struct GNUNET_HashCode *port, enum GNUNET_CADET_ChannelOption options) { static const struct SetVT incoming_vt = { @@ -1805,7 +1805,7 @@ channel_new_cb (void *cls, }; struct Operation *incoming; - if (GNUNET_APPLICATION_TYPE_SET != port) + if (0 != memcmp (GC_u2h (GNUNET_APPLICATION_TYPE_SET), port, sizeof (*port))) { GNUNET_break (0); GNUNET_CADET_channel_destroy (channel); @@ -1988,7 +1988,6 @@ run (void *cls, { &dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_DONE, 0}, {NULL, 0, 0} }; - static const uint32_t cadet_ports[] = {GNUNET_APPLICATION_TYPE_SET, 0}; configuration = cfg; GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); @@ -1998,10 +1997,11 @@ run (void *cls, server_handlers); _GSS_statistics = GNUNET_STATISTICS_create ("set", cfg); cadet = GNUNET_CADET_connect (cfg, NULL, - &channel_new_cb, &channel_end_cb, - cadet_handlers, - cadet_ports); + cadet_handlers); + GNUNET_CADET_open_port (cadet, + GC_u2h (GNUNET_APPLICATION_TYPE_SET), + &channel_new_cb, NULL); if (NULL == cadet) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c index ae7cb57cc..812016205 100644 --- a/src/vpn/gnunet-service-vpn.c +++ b/src/vpn/gnunet-service-vpn.c @@ -758,7 +758,7 @@ handle_regex_result (void *cls, ts->channel = GNUNET_CADET_channel_create (cadet_handle, ts, id, - apptype, + GC_u2h (apptype), GNUNET_CADET_OPTION_DEFAULT); } @@ -801,7 +801,7 @@ create_channel_to_destination (struct DestinationChannel *dt, ts->channel = GNUNET_CADET_channel_create (cadet_handle, ts, &dt->destination->details.service_destination.target, - apptype, + GC_u2h (apptype), GNUNET_CADET_OPTION_DEFAULT); if (NULL == ts->channel) { @@ -3090,10 +3090,9 @@ run (void *cls, cadet_handle = GNUNET_CADET_connect (cfg_, NULL, - NULL, &channel_cleaner, - cadet_handlers, - NULL); + cadet_handlers); + // FIXME never opens ports??? helper_handle = GNUNET_HELPER_start (GNUNET_NO, "gnunet-helper-vpn", vpn_argv, &message_token, NULL, NULL); -- cgit v1.2.3