ext/iodine/redis_engine.c
/** Called when the connection was closed, but will not run concurrently */
Called when the connection was closed, but will not run concurrently
Called when the connection was closed but will not run concurrently
static void redis_on_close(intptr_t uuid, fio_protocol_s *pr) {
  struct redis_engine_internal_s *internal =
      (struct redis_engine_internal_s *)pr;
  redis_internal_reset(internal);
  redis_engine_s *r;
  if (internal->on_message == resp_on_sub_message) {
    r = sub2redis(pr);
    fiobj_free(r->last_ch);
    r->last_ch = FIOBJ_INVALID;
    if (r->flag) {
      if (uuid != -1) {
        FIO_LOG_WARNING("(redis %d) subscription connection lost. "
                        "Reconnecting...",
                        (int)getpid());
      }
      fio_atomic_sub(&r->ref, 1);
      defer_redis_connect(r, internal);
    } else {
      redis_free(r);
    }
  } else {
    r = pub2redis(pr);
    if (r->flag && uuid != -1) {
      FIO_LOG_WARNING("(redis %d) publication connection lost. "
                      "Reconnecting...",
                      (int)getpid());
    }
    r->pub_sent = 0;
    fio_close(r->sub_data.uuid);
    redis_free(r);
  }
  (void)uuid;
}
static void redis_on_close ( intptr_t uuid , fio_protocol_s * pr ) { struct redis_engine_internal_s * internal = ( struct redis_engine_internal_s * ) pr ; redis_internal_reset ( internal ) ; redis_engine_s * r ; if ( internal -> on_message == resp_on_sub_message ) { r = sub2redis ( pr ) ; fiobj_free ( r -> last_ch ) ; r -> last_ch = FIOBJ_INVALID ; if ( r -> flag ) { if ( uuid != -1 ) { FIO_LOG_WARNING ( " " " " , ( int ) getpid ( ) ) ; } fio_atomic_sub ( & r -> ref , 1 ) ; defer_redis_connect ( r , internal ) ; } else { redis_free ( r ) ; } } else { r = pub2redis ( pr ) ; if ( r -> flag && uuid != -1 ) { FIO_LOG_WARNING ( " " " " , ( int ) getpid ( ) ) ; } r -> pub_sent = 0 ; fio_close ( r -> sub_data . uuid ) ; redis_free ( r ) ; } ( void ) uuid ; }
Called when the connection was closed, but will not run concurrently
Called when the connection was closed but will not run concurrently
/* reconnection for subscription connection. */