diff options
Diffstat (limited to 'src/pq/pq_event.c')
-rw-r--r-- | src/pq/pq_event.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/pq/pq_event.c b/src/pq/pq_event.c index 879caf842..74b8b3653 100644 --- a/src/pq/pq_event.c +++ b/src/pq/pq_event.c | |||
@@ -365,6 +365,42 @@ manage_subscribe (struct GNUNET_PQ_Context *db, | |||
365 | } | 365 | } |
366 | 366 | ||
367 | 367 | ||
368 | /** | ||
369 | * Re-subscribe to notifications after disconnect. | ||
370 | * | ||
371 | * @param cls the DB context | ||
372 | * @param sh the short hash of the channel | ||
373 | * @param eh the event handler | ||
374 | * @return #GNUNET_OK to continue to iterate | ||
375 | */ | ||
376 | static int | ||
377 | register_notify (void *cls, | ||
378 | const struct GNUNET_ShortHashCode *sh, | ||
379 | void *value) | ||
380 | { | ||
381 | struct GNUNET_PQ_Context *db = cls; | ||
382 | struct GNUNET_PQ_EventHandler *eh = value; | ||
383 | |||
384 | manage_subscribe (db, | ||
385 | "LISTEN ", | ||
386 | eh); | ||
387 | return GNUNET_OK; | ||
388 | } | ||
389 | |||
390 | |||
391 | void | ||
392 | GNUNET_PQ_event_reconnect_ (struct GNUNET_PQ_Context *db) | ||
393 | { | ||
394 | GNUNET_assert (0 == | ||
395 | pthread_mutex_lock (&db->notify_lock)); | ||
396 | GNUNET_CONTAINER_multishortmap_iterate (db->channel_map, | ||
397 | ®ister_notify, | ||
398 | db); | ||
399 | GNUNET_assert (0 == | ||
400 | pthread_mutex_unlock (&db->notify_lock)); | ||
401 | } | ||
402 | |||
403 | |||
368 | struct GNUNET_PQ_EventHandler * | 404 | struct GNUNET_PQ_EventHandler * |
369 | GNUNET_PQ_event_listen (struct GNUNET_PQ_Context *db, | 405 | GNUNET_PQ_event_listen (struct GNUNET_PQ_Context *db, |
370 | const struct GNUNET_PQ_EventHeaderP *es, | 406 | const struct GNUNET_PQ_EventHeaderP *es, |