ext/iodine/redis_engine.c
/** Called when a data is available, but will not run concurrently */
Called when a data is available, but will not run concurrently
Called when a data is available but will not run concurrently
static void redis_on_data(intptr_t uuid, fio_protocol_s *pr) {
  struct redis_engine_internal_s *internal =
      (struct redis_engine_internal_s *)pr;
  uint8_t *buf;
  if (internal->on_message == resp_on_sub_message) {
    buf = sub2redis(pr)->buf + REDIS_READ_BUFFER;
  } else {
    buf = pub2redis(pr)->buf;
  }
  ssize_t i = fio_read(uuid, buf + internal->buf_pos,
                       REDIS_READ_BUFFER - internal->buf_pos);
  if (i <= 0)
    return;
  internal->buf_pos += i;
  i = resp_parse(&internal->parser, buf, internal->buf_pos);
  if (i) {
    memmove(buf, buf + internal->buf_pos - i, i);
  }
  internal->buf_pos = i;
}
static void redis_on_data ( intptr_t uuid , fio_protocol_s * pr ) { struct redis_engine_internal_s * internal = ( struct redis_engine_internal_s * ) pr ; uint8_t * buf ; if ( internal -> on_message == resp_on_sub_message ) { buf = sub2redis ( pr ) -> buf + REDIS_READ_BUFFER ; } else { buf = pub2redis ( pr ) -> buf ; } ssize_t i = fio_read ( uuid , buf + internal -> buf_pos , REDIS_READ_BUFFER - internal -> buf_pos ) ; if ( i <= 0 ) return ; internal -> buf_pos += i ; i = resp_parse ( & internal -> parser , buf , internal -> buf_pos ) ; if ( i ) { memmove ( buf , buf + internal -> buf_pos - i , i ) ; } internal -> buf_pos = i ; }
Called when a data is available, but will not run concurrently
Called when a data is available but will not run concurrently