aboutsummaryrefslogtreecommitdiff
path: root/src/dhtu/plugin_dhtu_gnunet.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-01-10 21:51:53 +0100
committerChristian Grothoff <christian@grothoff.org>2022-02-19 12:39:55 +0100
commitba9296269617c157baffb59a6240c87ae5935e95 (patch)
tree7f82470cce894be0b3441f8150baea36d7138834 /src/dhtu/plugin_dhtu_gnunet.c
parent25ef40ef768743a10b7b29881c267e0fdc9fc677 (diff)
downloadgnunet-ba9296269617c157baffb59a6240c87ae5935e95.tar.gz
gnunet-ba9296269617c157baffb59a6240c87ae5935e95.zip
first steps towards usable dhtu
Diffstat (limited to 'src/dhtu/plugin_dhtu_gnunet.c')
-rw-r--r--src/dhtu/plugin_dhtu_gnunet.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/src/dhtu/plugin_dhtu_gnunet.c b/src/dhtu/plugin_dhtu_gnunet.c
index 2163af941..a75c47ce3 100644
--- a/src/dhtu/plugin_dhtu_gnunet.c
+++ b/src/dhtu/plugin_dhtu_gnunet.c
@@ -70,11 +70,6 @@ struct GNUNET_DHTU_Source
70{ 70{
71 71
72 /** 72 /**
73 * Hash of @e pid, position of this peer in the DHT overlay.
74 */
75 struct GNUNET_DHTU_HashKey id;
76
77 /**
78 * Application context for this source. 73 * Application context for this source.
79 */ 74 */
80 void *app_ctx; 75 void *app_ctx;
@@ -125,11 +120,6 @@ struct GNUNET_DHTU_Target
125 struct GNUNET_PeerIdentity pid; 120 struct GNUNET_PeerIdentity pid;
126 121
127 /** 122 /**
128 * Hash of @e pid, position of this peer in the DHT overlay.
129 */
130 struct GNUNET_DHTU_HashKey id;
131
132 /**
133 * Preference counter, length of the @a ph_head DLL. 123 * Preference counter, length of the @a ph_head DLL.
134 */ 124 */
135 unsigned int ph_count; 125 unsigned int ph_count;
@@ -240,10 +230,12 @@ hello_offered_cb (void *cls)
240 * Request creation of a session with a peer at the given @a address. 230 * Request creation of a session with a peer at the given @a address.
241 * 231 *
242 * @param cls closure (internal context for the plugin) 232 * @param cls closure (internal context for the plugin)
233 * @param pid target identity of the peer to connect to
243 * @param address target address to connect to 234 * @param address target address to connect to
244 */ 235 */
245static void 236static void
246ip_try_connect (void *cls, 237ip_try_connect (void *cls,
238 struct GNUNET_PeerIdentity *pid,
247 const char *address) 239 const char *address)
248{ 240{
249 struct Plugin *plugin = cls; 241 struct Plugin *plugin = cls;
@@ -251,16 +243,13 @@ ip_try_connect (void *cls,
251 struct HelloHandle *hh; 243 struct HelloHandle *hh;
252 struct GNUNET_CRYPTO_EddsaPublicKey pubkey; 244 struct GNUNET_CRYPTO_EddsaPublicKey pubkey;
253 245
246 (void) pid; /* will be needed with future address URIs */
254 if (GNUNET_OK != 247 if (GNUNET_OK !=
255 GNUNET_HELLO_parse_uri (address, 248 GNUNET_HELLO_parse_uri (address,
256 &pubkey, 249 &pubkey,
257 &hello, 250 &hello,
258 &GPI_plugins_find)) 251 &GPI_plugins_find))
259 {
260 GNUNET_break (0);
261 return; 252 return;
262 }
263
264 hh = GNUNET_new (struct HelloHandle); 253 hh = GNUNET_new (struct HelloHandle);
265 hh->plugin = plugin; 254 hh->plugin = plugin;
266 GNUNET_CONTAINER_DLL_insert (plugin->hh_head, 255 GNUNET_CONTAINER_DLL_insert (plugin->hh_head,
@@ -394,12 +383,9 @@ core_connect_cb (void *cls,
394 target->plugin = plugin; 383 target->plugin = plugin;
395 target->mq = mq; 384 target->mq = mq;
396 target->pid = *peer; 385 target->pid = *peer;
397 GNUNET_CRYPTO_hash (peer,
398 sizeof (*peer),
399 &target->id.sha512);
400 plugin->env->connect_cb (plugin->env->cls, 386 plugin->env->connect_cb (plugin->env->cls,
401 target, 387 target,
402 &target->id, 388 &target->pid,
403 &target->app_ctx); 389 &target->app_ctx);
404 return target; 390 return target;
405} 391}
@@ -461,11 +447,7 @@ peerinfo_cb (void *cls,
461 &GPI_plugins_find); 447 &GPI_plugins_find);
462 if (NULL == addr) 448 if (NULL == addr)
463 return; 449 return;
464 GNUNET_CRYPTO_hash (peer,
465 sizeof (*peer),
466 &plugin->src.id.sha512);
467 plugin->env->address_add_cb (plugin->env->cls, 450 plugin->env->address_add_cb (plugin->env->cls,
468 &plugin->src.id,
469 addr, 451 addr,
470 &plugin->src, 452 &plugin->src,
471 &plugin->src.app_ctx); 453 &plugin->src.app_ctx);
@@ -584,6 +566,10 @@ libgnunet_plugin_dhtu_gnunet_done (void *cls)
584 } 566 }
585 if (NULL != plugin->nse) 567 if (NULL != plugin->nse)
586 GNUNET_NSE_disconnect (plugin->nse); 568 GNUNET_NSE_disconnect (plugin->nse);
569 plugin->env->network_size_cb (plugin->env->cls,
570 GNUNET_TIME_UNIT_FOREVER_ABS,
571 0.0,
572 0.0);
587 if (NULL != plugin->core) 573 if (NULL != plugin->core)
588 GNUNET_CORE_disconnect (plugin->core); 574 GNUNET_CORE_disconnect (plugin->core);
589 if (NULL != plugin->ats) 575 if (NULL != plugin->ats)