-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support hiredis >= 1.0 #8
Conversation
hiredis changed the layout of redisReplyObjectFunctions in version 1.0.0. two new functions were added for double and boolean replies. add double and boolean to redisTypes, and create functions for handling the replies. add them to the list set on the redisReader.
I also cannot evaluate the XS very well but will test the changes with different versions of hiredis. Thank you for the contribution. |
me-too :)
In "production" i did not encounter any segfaults, but it looks like because I'm using redis as pub-sub only. Anyway i think that tests must complete successfully, that is their purpose, right? |
Had to go digging a bit as this is not indicated in the hiredis changelog, but the changes to perlRedisFunctions are necessary because of the RESP3 support added in redis/hiredis#697 . They look okay to me but I'd be more comfortable if someone with knowledge of Perl NVs in particular could review createDoubleObjectSV, the specification of the double type that will be received can be found at https://github.com/redis/redis-specifications/blob/master/protocol/RESP3.md#Simple-Types |
Suggested by @mauke as sv_setnv will clear the string value that was just set. This will return a PVNV dualvar which stringifies to the format of the double originally parsed from the Redis reply string.
Thank you! This should allow building against hiredis 1.0+, full support for RESP3 should come later and under a different API specification. #12 |
i'm on a system with hiredis 1.0.2 installed. i ran into problems with Protocol::Redis::XS (segfaults and "bizarre copy of UNKNOWN" errors from perl), so i hacked some stuff together to get it working with the newer version.
i have pretty much no idea what i'm doing in XS, so please review carefully. this change "works for me," but it's likely i've done horrible things i'm unaware of. i added #if guards around the changes to hopefully keep it working on older versions of hiredis, but haven't been able to test that.
hope it's helpful.