Skip to content
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

Add support for CLIENT SETNAME command to cpp_redis::Subscriber #22

Merged
merged 3 commits into from
Apr 1, 2019

Conversation

dgpetrie
Copy link

Add the ability to send the CLIENT SETNAME command to label the subscriber client connection on the server side. This is useful for debugging and management from the server side of things, particularly when you have a large number of connections.

The CLIENT command must be sent after the AUTH (if used) and before the first SUBSCRIBE command is sent or the Redis server will issue an error. In order for this to work after a reconnect, the subscriber needs to manage the re-issuing of the CLIENT SETNAME command to be sure it is sent after re_auth and before the re_subscribe occurs.

  Redis server supports 64 bit ints for TTL.
  Actually up to 0x7FFFFFFFFFFFFFFFLL milliseconds.
  Or 0x7FFFFFFFFFFFFFFFLL/1000 seconds.
… problem were the AUTH

command got serialized twice to the buffer to be sent to the TCP connection by unprotected_auth:
  Once when it was directly added to the buffer AND
  Once because it was added to the command queue it got serialize to the buffer again
However there was only one call back on the command queue.  So we got 2 responces and only
one callback to handle them.  So the next command in the queue gets the second AUTH response
instead of the expected responce and everything is off by one.
@appkins
Copy link

appkins commented Apr 1, 2019

The CI build passed for Linux. I still need to update the OSX build this week, I'm going to merge the commit.

@appkins appkins merged commit 6641cd0 into cpp-redis:master Apr 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants