hiredis
hiredis copied to clipboard
Is there a way to tell hiredis to disconnect in the async onConnect callback?
https://github.com/redis/hiredis/blob/master/async.c#L620 If I call redisAsyncDisconnect() in the onConnect callback, the redisContext pointer "c" will point to a freed memory, this might make a crash.
may be, a REDIS_IN_CALLBACK like flag which protecting the context object will help?
The onConnect callback gives you a const redisAsyncContext *ac
so you really shouldn't be mutating it there.
What's the use case for this?
I am a library writer, the library's user may do some checking logic in business layer in onConnect callback. In some situation, the user would like to close the connection when checking failed. I cant control the user's code, so I came here to see whether there is any solution. @michael-grunder
Closing as this is now possible as #931 was merged and then modified slightly in #1087