ext/iodine/redis_engine.c
/** a local static callback, called when the RESP message is complete. */
a local static callback, called when the RESP message is complete.
a local static callback called when the RESP message is complete .
static void resp_on_pub_message(struct redis_engine_internal_s *i, FIOBJ msg) {
  redis_engine_s *r = pub2redis(i);
  if (FIO_LOG_LEVEL >= FIO_LOG_LEVEL_DEBUG) {
    FIOBJ json = fiobj_obj2json(msg, 1);
    FIO_LOG_DEBUG("Redis reply:\n%s\n", fiobj_obj2cstr(json).data);
    fiobj_free(json);
  }
  fio_lock(&r->lock);
  fio_ls_embd_s *node = fio_ls_embd_shift(&r->queue);
  r->pub_sent = 0;
  redis_send_next_command_unsafe(r);
  fio_unlock(&r->lock);
  if (!node) {
    FIO_LOG_WARNING("(redis %d) received a reply when no command was sent.",
                    (int)getpid());
    return;
  }
  node->next = (void *)fiobj_dup(msg);
  fio_defer(redis_perform_callback, &r->en,
            FIO_LS_EMBD_OBJ(redis_commands_s, node, node));
}
static void resp_on_pub_message ( struct redis_engine_internal_s * i , FIOBJ msg ) { redis_engine_s * r = pub2redis ( i ) ; if ( FIO_LOG_LEVEL >= FIO_LOG_LEVEL_DEBUG ) { FIOBJ json = fiobj_obj2json ( msg , 1 ) ; FIO_LOG_DEBUG ( " \n \n " , fiobj_obj2cstr ( json ) . data ) ; fiobj_free ( json ) ; } fio_lock ( & r -> lock ) ; fio_ls_embd_s * node = fio_ls_embd_shift ( & r -> queue ) ; r -> pub_sent = 0 ; redis_send_next_command_unsafe ( r ) ; fio_unlock ( & r -> lock ) ; if ( ! node ) { FIO_LOG_WARNING ( " " , ( int ) getpid ( ) ) ; return ; } node -> next = ( void * ) fiobj_dup ( msg ) ; fio_defer ( redis_perform_callback , & r -> en , FIO_LS_EMBD_OBJ ( redis_commands_s , node , node ) ) ; }
a local static callback, called when the RESP message is complete.
a local static callback called when the RESP message is complete .
// #if DEBUG // #endif /* publishing / command parser */ /* TODO: possible ping? from server?! not likely... */