From 236e77035c111dfc29e4f9910ec1ad1700b6d64e Mon Sep 17 00:00:00 2001 From: Emil Haukeland Date: Thu, 26 Apr 2018 09:37:53 +0200 Subject: [PATCH 1/2] Added publish support(?) --- notes/redis.md | 2 +- src/nc_message.h | 1 + src/proto/nc_redis.c | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/notes/redis.md b/notes/redis.md index 1f5fefea..cfbbb446 100644 --- a/notes/redis.md +++ b/notes/redis.md @@ -287,7 +287,7 @@ +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+ | PSUBSCRIBE | No | PSUBSCRIBE pattern [pattern ...] | +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+ - | PUBLISH | No | PUBLISH channel message | + | PUBLISH | Yes | PUBLISH channel message | +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+ | PUNSUBSCRIBE | No | PUNSUBSCRIBE [pattern [pattern ...]] | +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+ diff --git a/src/nc_message.h b/src/nc_message.h index 2844c824..a2c07175 100644 --- a/src/nc_message.h +++ b/src/nc_message.h @@ -122,6 +122,7 @@ typedef enum msg_parse_result { ACTION( REQ_REDIS_PFADD ) /* redis requests - hyperloglog */ \ ACTION( REQ_REDIS_PFCOUNT ) \ ACTION( REQ_REDIS_PFMERGE ) \ + ACTION( REQ_REDIS_PUBLISH ) \ ACTION( REQ_REDIS_RPOP ) \ ACTION( REQ_REDIS_RPOPLPUSH ) \ ACTION( REQ_REDIS_RPUSH ) \ diff --git a/src/proto/nc_redis.c b/src/proto/nc_redis.c index 2db88882..c2bb4857 100644 --- a/src/proto/nc_redis.c +++ b/src/proto/nc_redis.c @@ -128,6 +128,8 @@ redis_arg1(struct msg *r) case MSG_REQ_REDIS_RPOPLPUSH: case MSG_REQ_REDIS_RPUSHX: + case MSG_REQ_REDIS_PUBLISH: + case MSG_REQ_REDIS_SISMEMBER: case MSG_REQ_REDIS_ZRANK: @@ -937,6 +939,11 @@ redis_parse_req(struct msg *r) break; } + if (str7icmp(m, 'p', 'u', 'b', 'l', 'i', 's', 'h')) { + r->type = MSG_REQ_REDIS_PUBLISH; + break; + } + break; case 8: From 6784a72f89d1022b1b2e753db7885923d26d1008 Mon Sep 17 00:00:00 2001 From: Emil Haukeland Date: Thu, 26 Apr 2018 10:16:10 +0200 Subject: [PATCH 2/2] Formatting --- src/nc_message.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nc_message.h b/src/nc_message.h index a2c07175..67115042 100644 --- a/src/nc_message.h +++ b/src/nc_message.h @@ -122,7 +122,7 @@ typedef enum msg_parse_result { ACTION( REQ_REDIS_PFADD ) /* redis requests - hyperloglog */ \ ACTION( REQ_REDIS_PFCOUNT ) \ ACTION( REQ_REDIS_PFMERGE ) \ - ACTION( REQ_REDIS_PUBLISH ) \ + ACTION( REQ_REDIS_PUBLISH ) \ ACTION( REQ_REDIS_RPOP ) \ ACTION( REQ_REDIS_RPOPLPUSH ) \ ACTION( REQ_REDIS_RPUSH ) \