Commit Graph

30 Commits

Author SHA1 Message Date
Michael Grunder 2e7d7cbabd
Resp3 oob push support (#841)
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-07-19 18:54:42 -07:00
Michael Grunder 8e0264cfd6
Allow users to replace allocator and handle OOM everywhere. (#800)
* 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-05-22 09:27:49 -07:00
Nick Rivera 0184caac9d
Provides an optional cleanup callback for async data. 2020-04-09 20:23:06 -07:00
Yossi Gottlieb 8715ba5c82 wip: SSL code reorganization, see #705. 2019-08-29 22:09:37 +03:00
Mark Nunberg deba8d956d Allow connectWithOptions for async as well 2019-02-20 09:10:10 -05:00
Mark Nunberg 35a0a1f369 read/write timeouts 2019-02-20 09:10:10 -05:00
Mark Nunberg 49974c9359 Call connect(2) again for non-blocking connect
This retrieves the actual error which occurred, as getsockopt is not
always reliable in this regard.
2018-09-25 20:21:37 -04:00
Hyungjin Kim 073dc84399 Counting pending subscribe. Fix #396 2016-09-30 00:26:32 +09:00
mike 7c4d2557c4 Add support for SO_REUSEADDR
[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-05 16:39:30 -05:00
Hang Su 3315c09839 Use stricter function argument types
'const' where we can.

Closes #268
2015-01-05 11:21:38 -05:00
Pieter Noordhuis a9c21e4d48 Fix const correctness 2014-04-09 22:30:04 -07:00
Matt Stancliff 37d25a392c Add ability to bind source address on connect
Some environments require binding to specific source addresses instead
of letting the system determine which IP a connection should originate
from.

Closes #233
2014-04-08 19:37:54 -04:00
Pieter Noordhuis 3313bcd191 Change prototype of connect callback
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-06-27 23:52:29 +02:00
Pieter Noordhuis 0cb7c27d9c Update license 2011-04-21 22:46:23 +02:00
Pieter Noordhuis 6d207ea98e Create protocol reader when creating context 2011-04-21 15:04:42 +02:00
Pieter Noordhuis c6b8bd77c0 Make dictionary functions static and include the .c file 2011-01-14 12:07:29 +01:00
Pieter Noordhuis e6621d05b4 Add fields for subscribed channel/pattern names 2010-12-31 15:49:26 +01:00
Pieter Noordhuis a020db3013 License 2010-12-29 15:52:07 +01:00
Pieter Noordhuis 18c55a8f1e Scope event library related data and hooks to a struct 2010-12-29 15:41:03 +01:00
Pieter Noordhuis e3776bfaa6 Add function to explicitly free an async context 2010-12-28 19:19:25 +01:00
Nicolas Favre-Felix 2c17d2e221 Missing declaration. 2010-12-22 18:01:50 +01:00
Pieter Noordhuis 12725f88ed Fire onConnect callback on the first write event 2010-12-07 10:22:30 +01:00
Pieter Noordhuis af7369a253 Use extra field for adapter-specific data
This makes sure that the "data" field on the asynchronous context can be
used for user-specific data.
2010-12-01 16:43:24 +01:00
Ryan Tecco a01c5b1352 more extern "C" declarations for C++ compiles 2010-11-21 16:21:46 -08:00
Pieter Noordhuis 09a0fe626f Explicitly initialize struct fields to NULL 2010-11-15 21:53:22 +01:00
Pieter Noordhuis ffa8666a64 Change error reporting to have an explicit type
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-02 16:36:38 +01:00
Pieter Noordhuis b673f0cfb3 Change prototype of async reply callback 2010-11-01 13:21:26 +01:00
Pieter Noordhuis 437eea80fc Make error ptr accessible from async context 2010-11-01 09:52:17 +01:00
Pieter Noordhuis 4e3bd7893d Add support to lazily disconnect an asynchronous connection 2010-11-01 09:27:43 +01:00
Pieter Noordhuis 0152f12807 Extracted code to support callbacks in an asynchronous context 2010-10-31 21:20:47 +01:00