summaryrefslogtreecommitdiff
path: root/async.h
AgeCommit message (Collapse)Author
2022-08-26Maintain backward compatibiliy withour onConnect callback.michael-grunder
In f69fac7690fb22a7fc19dba61ef70e5f79ccb2e9, our async onConnect callback was improved to take a non-const redisAsyncContext allowing it to be reentrant. Unfortunately, this is a breaking change we can't make until hiredis v2.0.0. This commit creates a separate callback member and corresponding function that allows us to use the new functionality, while maintaining our existing API for legacy code. Fixes #1086
2022-07-08Drop `const` on redisAsyncContext in redisConnectCallbackKristján Valur Jónsson
Since the callback is now re-entrant, it can call apis such as redisAsyncDisconnect()
2022-02-03Handle any pipelined unsubscribe in asyncBjörn Svensson
Redis responds to an unsubscribe with one or many replies, depending on the current subscribe state. When channels/patterns names are provided in a command each given name will trigger a reply even if duplicated or not subscribed to. To know when we can return from the subscribed state we need to do bookkeeping on pending additional unsubscribe replies, and make sure we receive them all before switching state.
2021-12-16Support PING while subscribing (RESP2) (#1027)Bjorn Svensson
* Handle PING during pubsub in RESP2 * Rename invalid callback list Some commands are valid to send during a subscribe in RESP2, and most in RESP3. Renaming the callback list from `invalid` to `replies` to detail this fact. * Fix review comment
2020-07-19Resp3 oob push support (#841)Michael Grunder
Proper support for RESP3 PUSH messages. By default, PUSH messages are now intercepted and the reply memory freed. This means existing code should work unchanged when connecting to Redis >= 6.0.0 even if `CLIENT TRACKING` were then enabled. Additionally, we define two callbacks users can configure if they wish to handle these messages in a custom way: void redisPushFn(void *privdata, void *reply); void redisAsyncPushFn(redisAsyncContext *ac, void *reply); See #825
2020-05-22Allow users to replace allocator and handle OOM everywhere. (#800)Michael Grunder
* Adds an indirection to every allocation/deallocation to allow users to plug in ones of their choosing (use custom functions, jemalloc, etc). * Gracefully handle OOM everywhere in hiredis. This should make it possible for users of the library to have more flexibility in how they handle such situations. * Changes `redisReaderTask->elements` from an `int` to a `long long` to prevent a possible overflow when transferring the task elements into a `redisReply`. * Adds a configurable `max elements` member to `redisReader` that defaults to 2^32 - 1. This can be set to "unlimited" by setting the value to zero.
2020-04-09Provides an optional cleanup callback for async data.Nick Rivera
2019-08-29wip: SSL code reorganization, see #705.Yossi Gottlieb
2019-02-20Allow connectWithOptions for async as wellMark Nunberg
2019-02-20read/write timeoutsMark Nunberg
2018-09-25Call connect(2) again for non-blocking connectMark Nunberg
This retrieves the actual error which occurred, as getsockopt is not always reliable in this regard.
2016-09-30Counting pending subscribe. Fix #396Hyungjin Kim
2015-01-05Add support for SO_REUSEADDRmike
[This introduces some new API functions.] * Adds new flag to the connection context indicating SO_REUSEADDR should be set. * Adds max number of retries constant for when connect() hits EADDRNOTAVAIL. * Adds new function, redisAsyncConnectBindWithReuse(), letting clients enable this functionality. [Removed trailing whitespace in new header lines.] Closes #264
2015-01-05Use stricter function argument typesHang Su
'const' where we can. Closes #268
2014-04-09Fix const correctnessPieter Noordhuis
2014-04-08Add ability to bind source address on connectMatt Stancliff
Some environments require binding to specific source addresses instead of letting the system determine which IP a connection should originate from. Closes #233
2011-06-27Change prototype of connect callbackPieter Noordhuis
This commit adds a status argument to the connect callback. It will be called in the event of an unsuccessful connection as well, where the status argument is set to REDIS_ERR. It is set to REDIS_OK otherwise.
2011-04-21Update licensePieter Noordhuis
2011-04-21Create protocol reader when creating contextPieter Noordhuis
2011-01-14Make dictionary functions static and include the .c filePieter Noordhuis
2010-12-31Add fields for subscribed channel/pattern namesPieter Noordhuis
2010-12-29LicensePieter Noordhuis
2010-12-29Scope event library related data and hooks to a structPieter Noordhuis
2010-12-28Add function to explicitly free an async contextPieter Noordhuis
2010-12-22Missing declaration.Nicolas Favre-Felix
2010-12-07Fire onConnect callback on the first write eventPieter Noordhuis
2010-12-01Use extra field for adapter-specific dataPieter Noordhuis
This makes sure that the "data" field on the asynchronous context can be used for user-specific data.
2010-11-21more extern "C" declarations for C++ compilesRyan Tecco
2010-11-15Explicitly initialize struct fields to NULLPieter Noordhuis
2010-11-02Change error reporting to have an explicit typePieter Noordhuis
When there is an I/O error, errno should be used to find out what is wrong. In other cases, errno cannot be used. So, use an explicit type in Hiredis to define the different error scenarios that can occur.
2010-11-01Change prototype of async reply callbackPieter Noordhuis
2010-11-01Make error ptr accessible from async contextPieter Noordhuis
2010-11-01Add support to lazily disconnect an asynchronous connectionPieter Noordhuis
2010-10-31Extracted code to support callbacks in an asynchronous contextPieter Noordhuis