ext/iodine/redis_engine.c
/* *****************************************************************************
Engine / Bridge Callbacks (Root Process)
***************************************************************************** */
Engine / Bridge Callbacks (Root Process)
Engine / Bridge Callbacks ( Root Process )
static void redis_on_subscribe_root(const fio_pubsub_engine_s *eng,
                                    fio_str_info_s channel,
                                    fio_match_fn match) {
  redis_engine_s *r = (redis_engine_s *)eng;
  if (r->sub_data.uuid != -1) {
    FIOBJ cmd = fiobj_str_buf(96 + channel.len);
    if (match == FIO_MATCH_GLOB)
      fiobj_str_write(cmd, "*2\r\n$10\r\nPSUBSCRIBE\r\n$", 22);
    else
      fiobj_str_write(cmd, "*2\r\n$9\r\nSUBSCRIBE\r\n$", 20);
    fiobj_str_write_i(cmd, channel.len);
    fiobj_str_write(cmd, "\r\n", 2);
    fiobj_str_write(cmd, channel.data, channel.len);
    fiobj_str_write(cmd, "\r\n", 2);
    fiobj_send_free(r->sub_data.uuid, cmd);
  }
}
static void redis_on_subscribe_root ( const fio_pubsub_engine_s * eng , fio_str_info_s channel , fio_match_fn match ) { redis_engine_s * r = ( redis_engine_s * ) eng ; if ( r -> sub_data . uuid != -1 ) { FIOBJ cmd = fiobj_str_buf ( 96 + channel . len ) ; if ( match == FIO_MATCH_GLOB ) fiobj_str_write ( cmd , " \r \n \r \n \r \n " , 22 ) ; else fiobj_str_write ( cmd , " \r \n \r \n \r \n " , 20 ) ; fiobj_str_write_i ( cmd , channel . len ) ; fiobj_str_write ( cmd , " \r \n " , 2 ) ; fiobj_str_write ( cmd , channel . data , channel . len ) ; fiobj_str_write ( cmd , " \r \n " , 2 ) ; fiobj_send_free ( r -> sub_data . uuid , cmd ) ; } }
Engine / Bridge Callbacks (Root Process)
Engine / Bridge Callbacks ( Root Process )
// { //   fio_str_info_s s = fiobj_obj2cstr(cmd); //   fprintf(stderr, "(%d) Sending Subscription (%p):\n%s\n", getpid(), //           (void *)r->sub_data.uuid, s.data); // }