From: Christian Grothoff Date: Sun, 14 Aug 2016 09:49:29 +0000 (+0000) Subject: -slightly better FS port conversion, more to be done _much_ later X-Git-Tag: initial-import-from-subversion-38251~385 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ae0700a8b5d905db4403a52dbf4a5eda5315e3ec;p=oweals%2Fgnunet.git -slightly better FS port conversion, more to be done _much_ later --- diff --git a/src/fs/gnunet-service-fs_cadet_client.c b/src/fs/gnunet-service-fs_cadet_client.c index 5b24b3116..4e268b93c 100644 --- a/src/fs/gnunet-service-fs_cadet_client.c +++ b/src/fs/gnunet-service-fs_cadet_client.c @@ -214,6 +214,7 @@ static void reset_cadet (struct CadetHandle *mh) { struct GNUNET_CADET_Channel *channel = mh->channel; + struct GNUNET_HashCode port; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Resetting cadet channel to %s\n", @@ -233,11 +234,14 @@ reset_cadet (struct CadetHandle *mh) GNUNET_CONTAINER_multihashmap_iterate (mh->waiting_map, &move_to_pending, mh); + GNUNET_CRYPTO_hash (GNUNET_APPLICATION_PORT_FS_BLOCK_TRANSFER, + strlen (GNUNET_APPLICATION_PORT_FS_BLOCK_TRANSFER), + &port); mh->channel = GNUNET_CADET_channel_create (cadet_handle, - mh, - &mh->target, - GC_u2h (GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER), - GNUNET_CADET_OPTION_RELIABLE); + mh, + &mh->target, + &port, + GNUNET_CADET_OPTION_RELIABLE); transmit_pending (mh); } @@ -518,6 +522,7 @@ static struct CadetHandle * get_cadet (const struct GNUNET_PeerIdentity *target) { struct CadetHandle *mh; + struct GNUNET_HashCode port; mh = GNUNET_CONTAINER_multipeermap_get (cadet_map, target); @@ -544,11 +549,14 @@ get_cadet (const struct GNUNET_PeerIdentity *target) &mh->target, mh, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); + GNUNET_CRYPTO_hash (GNUNET_APPLICATION_PORT_FS_BLOCK_TRANSFER, + strlen (GNUNET_APPLICATION_PORT_FS_BLOCK_TRANSFER), + &port); mh->channel = GNUNET_CADET_channel_create (cadet_handle, - mh, - &mh->target, - GC_u2h (GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER), - GNUNET_CADET_OPTION_RELIABLE); + mh, + &mh->target, + &port, + GNUNET_CADET_OPTION_RELIABLE); GNUNET_assert (mh == GNUNET_CONTAINER_multipeermap_get (cadet_map, target)); diff --git a/src/fs/gnunet-service-fs_cadet_server.c b/src/fs/gnunet-service-fs_cadet_server.c index 32fe4191a..ac86537c3 100644 --- a/src/fs/gnunet-service-fs_cadet_server.c +++ b/src/fs/gnunet-service-fs_cadet_server.c @@ -562,6 +562,8 @@ GSF_cadet_start_server () { &request_cb, GNUNET_MESSAGE_TYPE_FS_CADET_QUERY, sizeof (struct CadetQueryMessage)}, { NULL, 0, 0 } }; + struct GNUNET_HashCode port; + if (GNUNET_YES != GNUNET_CONFIGURATION_get_value_number (GSF_cfg, "fs", @@ -576,9 +578,13 @@ GSF_cadet_start_server () &cleaner_cb, handlers); GNUNET_assert (NULL != listen_channel); + GNUNET_CRYPTO_hash (GNUNET_APPLICATION_PORT_FS_BLOCK_TRANSFER, + strlen (GNUNET_APPLICATION_PORT_FS_BLOCK_TRANSFER), + &port); GNUNET_CADET_open_port (listen_channel, - GC_u2h (GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER), - &accept_cb, NULL); + &port, + &accept_cb, + NULL); }