Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
byroot committed Dec 20, 2023
1 parent 0f72a4a commit 571d942
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions hiredis-client/ext/redis_client/hiredis/hiredis_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,14 @@ static VALUE hiredis_connected_p(VALUE self) {
return Qtrue;
}

static VALUE hiredis_feed(VALUE self, VALUE response) {
CONNECTION(self, connection);
ENSURE_CONNECTED(connection);

int error = redisReaderFeed(connection->context->reader, RSTRING_PTR(response), RSTRING_LEN(response));
return error == REDIS_OK ? Qtrue : Qfalse;
}

static VALUE hiredis_write(VALUE self, VALUE command) {
Check_Type(command, T_ARRAY);

Expand Down Expand Up @@ -929,6 +937,8 @@ RUBY_FUNC_EXPORTED void Init_hiredis_connection(void) {
rb_define_private_method(rb_cHiredisConnection, "_reconnect", hiredis_reconnect, 2);
rb_define_method(rb_cHiredisConnection, "connected?", hiredis_connected_p, 0);

rb_define_method(rb_cHiredisConnection, "feed", hiredis_feed, 1);

rb_define_private_method(rb_cHiredisConnection, "_write", hiredis_write, 1);
rb_define_private_method(rb_cHiredisConnection, "_read", hiredis_read, 0);
rb_define_private_method(rb_cHiredisConnection, "flush", hiredis_flush, 0);
Expand Down

0 comments on commit 571d942

Please sign in to comment.