ext/iodine/fio.c
/**
 * Engines can ask facil.io to call the `subscribe` callback for all active
 * channels.
 *
 * This allows engines that lost their connection to their Pub/Sub service to
 * resubscribe all the currently active channels with the new connection.
 *
 * CAUTION: This is an evented task... try not to free the engine's memory while
 * resubscriptions are under way...
 *
 * NOTE: the root (master) process will call `subscribe` for any channel in any
 * process, while all the other processes will call `subscribe` only for their
 * own channels. This allows engines to use the root (master) process as an
 * exclusive subscription process.
 */
Engines can ask facil.io to call the `subscribe` callback for all active
channels.

This allows engines that lost their connection to their Pub/Sub service to
resubscribe all the currently active channels with the new connection.

This is an evented task... try not to free the engine's memory while
resubscriptions are under way

the root (master) process will call `subscribe` for any channel in any
process, while all the other processes will call `subscribe` only for their
own channels. This allows engines to use the root (master) process as an
exclusive subscription process.
Engines can ask facil . io to call the ` subscribe ` callback for all active channels . This allows engines that lost their connection to their Pub / Sub service to resubscribe all the currently active channels with the new connection . This is an evented task ... try not to free the engine ' s memory while resubscriptions are under way the root ( master ) process will call ` subscribe ` for any channel in any process while all the other processes will call ` subscribe ` only for their own channels . This allows engines to use the root ( master ) process as an exclusive subscription process .
void fio_pubsub_reattach(fio_pubsub_engine_s *eng) {
  fio_lock(&fio_postoffice.pubsub.lock);
  FIO_SET_FOR_LOOP(&fio_postoffice.pubsub.channels, pos) {
    if (!pos->hash)
      continue;
    eng->subscribe(
        eng,
        (fio_str_info_s){.data = pos->obj->name, .len = pos->obj->name_len},
        NULL);
  }
  fio_unlock(&fio_postoffice.pubsub.lock);
  fio_lock(&fio_postoffice.patterns.lock);
  FIO_SET_FOR_LOOP(&fio_postoffice.patterns.channels, pos) {
    if (!pos->hash)
      continue;
    eng->subscribe(
        eng,
        (fio_str_info_s){.data = pos->obj->name, .len = pos->obj->name_len},
        pos->obj->match);
  }
  fio_unlock(&fio_postoffice.patterns.lock);
}
void fio_pubsub_reattach ( fio_pubsub_engine_s * eng ) { fio_lock ( & fio_postoffice . pubsub . lock ) ; FIO_SET_FOR_LOOP ( & fio_postoffice . pubsub . channels , pos ) { if ( ! pos -> hash ) continue ; eng -> subscribe ( eng , ( fio_str_info_s ) { . data = pos -> obj -> name , . len = pos -> obj -> name_len } , NULL ) ; } fio_unlock ( & fio_postoffice . pubsub . lock ) ; fio_lock ( & fio_postoffice . patterns . lock ) ; FIO_SET_FOR_LOOP ( & fio_postoffice . patterns . channels , pos ) { if ( ! pos -> hash ) continue ; eng -> subscribe ( eng , ( fio_str_info_s ) { . data = pos -> obj -> name , . len = pos -> obj -> name_len } , pos -> obj -> match ) ; } fio_unlock ( & fio_postoffice . patterns . lock ) ; }
Engines can ask facil.io to call the `subscribe` callback for all active
 channels.
Engines can ask facil . io to call the ` subscribe ` callback for all active channels .