Daniel Melani
05b85ebe7f
Less surprising behaviour.
...
Make redisFree() and freeReplyObject() less surprising by behaving just
like free(). That is, don't crash when passing in NULL.
2014-05-29 16:05:27 +02:00
Pieter Noordhuis
a9c21e4d48
Fix const correctness
2014-04-09 22:30:04 -07:00
antirez
334525359a
Upgrade sds to latest version
...
SDS is now broken out of Redis into its own project, so include
the latest version from the SDS repo.
This is a backport of the Redis commit doing the same to the bundled hiredis:
320fa02b9b
2014-04-09 17:02:42 -04:00
Axel Etcheverry
66192a0052
Add new redisAppendFormatedCommand with tests
...
Closes #202
2014-04-09 17:02:42 -04:00
Eddy Jansson
ae30d58ff9
Add redisConnectFd() and redisFreeKeepFd()
...
These allows for easier integration of hiredis with external
code that wants to manage its fds, say for instance in a pool.
Closes #223
2014-04-09 17:02:42 -04: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
Noah Williamsson
fbf1bb648e
Mark the timeout parameter as const in various functions
...
The struct timeval argument in redisConnectWithTimeout(),
redisConnectUnixWithTimeout(), redisSetTimeout(),
redisContextSetTimeout(), redisContextConnectTcp()
and redisContextConnectUnix() is never modified and can
therefore be marked as const.
Signed-off-by: Noah Williamsson <noah.williamsson@gmail.com>
2013-07-10 23:34:49 -07:00
Pieter Noordhuis
c532edc27f
Fix const-related compiler errors
2013-07-10 23:31:30 -07:00
Pieter Noordhuis
049346aa33
Merge pull request #132 from nwmcsween/constify
...
constify: constify some variables / functions
2013-07-10 23:13:36 -07:00
Wolfgang Richter
37a840dc2c
Emphasize size_t length for %b formatting
...
Closes #121 .
2013-07-10 23:05:39 -07:00
Allen.Dou
9dff5105fc
Make KeepAlive optional
...
Make Connection KeepAlive being optional instead of default.
2013-04-30 00:11:57 +08:00
Pieter Noordhuis
f05909cd53
Merge pull request #147 from hdoreau/d7e3268f48b457cb52336d264f8860b336faea9f
...
Prevent hiredis from crashing on memory allocation failure
2013-01-26 11:18:45 -08:00
Henri Doreau
814be4f5bd
Made connect functions return NULL on alloc failures.
...
Updated documentation and examples accordingly.
2013-01-22 10:19:46 +01:00
Nathan McSween
ba6c3c152c
constify: constify some variables / functions
2012-11-12 19:48:21 +00:00
Fabien MARTY
bf161d996f
Try again later for EINTR errors (see issue #99 )
2012-11-06 18:42:05 +01:00
antirez
f7f022e4e0
On stack buffer to read replies set to 16k (was 2k).
...
It was verified experimentally that this value, on Linux kernels, provides
better performances compared to the 2k value. However larger values
apparently don't produce any noticeable effect on performances.
2012-08-21 15:10:16 +02:00
antirez
51ab89d899
Max depth of multi-bulk reply moved from 2 to 7.
...
Hiredis can handle multi bulk replies with a fixed (hardcoded) level of
nesting. This should be changed in the future in order to avoid
hardcoded limits. As a quick fix this commit moves the max nesting from 2
to 7, so that there are no problems when processing replies from the SLOWLOG
command, from Redis Sentinel, or generated by Redis Lua Scripts (that are
allowed to generate replies with any level of nesting).
2012-08-21 15:06:06 +02:00
antirez
7f095053c6
Configurable reader max idle buffer size.
...
Hiredis used to free unused redisReader buffers bigger than 16k. Now
this limit is configurable (see the documentation updated by this commit)
in order to allow working with big payloads without incurring to speed
penalty.
2012-08-21 15:01:47 +02:00
Chip Salzenberg
56ae8aa110
DRY list of integer formats
2011-12-20 10:06:23 -08:00
mrb
52a29a124b
increase read depth by one, would allow ruby redis client to read from slowlog
2011-12-02 08:45:13 -05:00
John Zwinck
347528cf48
Fix minor inconsistencies in comment.
2011-11-28 16:37:35 -05:00
Pieter Noordhuis
2da784ce8f
Abort on invalid format
...
There is no way we can guess the width of the argument when we cannot
infer its type from the format specifier.
2011-07-09 15:08:45 +02:00
Pieter Noordhuis
27c96dde77
Use correct type when calling va_arg in formatter
2011-07-09 15:08:45 +02:00
Pieter Noordhuis
375ba48eea
Revert "Add function to retrieve formatted reply"
...
This reverts commit 77540aa316
. The change
in buffer strategy is too large to put in a minor release. It is put in
a separate branch in the meantime, so it can be refined and released
together with a minor version bump.
2011-06-19 13:41:25 +02:00
Pieter Noordhuis
5f5b3d9787
Fix for issue #45
2011-06-09 09:25:09 +02:00
Pieter Noordhuis
77540aa316
Add function to retrieve formatted reply
...
This is done by only truncating the read buffer once a full reply has
been read. The buffer is no longer truncated halfway through reading a
reply. In addition: pass offset/length of protocol and content via the
read tasks.
2011-05-05 17:01:34 +02:00
Pieter Noordhuis
0cb7c27d9c
Update license
2011-04-21 22:46:23 +02:00
Pieter Noordhuis
f3f02b6419
Let the async API segfault on OOM for now
2011-04-21 22:40:36 +02:00
Pieter Noordhuis
c9dc93e1de
Move chrtos to hiredis.c (not used elsewhere)
2011-04-21 22:39:19 +02:00
Pieter Noordhuis
8419b060f2
Handle OOM when doing blocking requests
2011-04-21 21:34:43 +02:00
Pieter Noordhuis
e932709a66
More safety
2011-04-21 21:18:08 +02:00
Pieter Noordhuis
dd5fc26457
Make command formatters gracefully abort when out of memory
2011-04-21 20:59:41 +02:00
Pieter Noordhuis
d4ebb60d65
More OOM checks in the protocol reader
2011-04-21 18:50:10 +02:00
Pieter Noordhuis
df1d693b03
Include fmacros.h to make sure strerror_p is defined on Linux
2011-04-21 16:24:03 +02:00
Pieter Noordhuis
965d42640f
Rename *ReplyReader* to *Reader*
2011-04-21 16:03:32 +02:00
Pieter Noordhuis
0ee7c66818
Use static buffer for error string on context
2011-04-21 15:56:22 +02:00
Pieter Noordhuis
6d207ea98e
Create protocol reader when creating context
2011-04-21 15:04:42 +02:00
Pieter Noordhuis
a926232293
Reply object functions can be set by the user after creating the reader
2011-04-21 14:37:29 +02:00
Pieter Noordhuis
5ba49014da
Privdata can be set directly on the struct
2011-04-21 14:34:03 +02:00
Pieter Noordhuis
2002218981
Remove useless casts
2011-04-21 14:31:02 +02:00
Pieter Noordhuis
e1abacb7b4
Return when memory cannot be allocated
2011-04-21 14:28:39 +02:00
Pieter Noordhuis
026636b0cd
Remove accessor functions now the redisReader struct is public
2011-04-21 14:27:03 +02:00
Pieter Noordhuis
727e1babec
Make redisReader struct public
2011-04-21 14:21:58 +02:00
Pieter Noordhuis
26588f5007
Test if there is a freeObject function
2011-04-21 10:54:15 +02:00
Pieter Noordhuis
eaf58bd32a
Use pre-allocated buffer for error strings in reader
2011-04-20 17:06:19 +02:00
Pieter Noordhuis
5d78214557
First pass at making the protocol reader properly handle OOM
2011-04-20 13:15:58 +02:00
Pieter Noordhuis
421eec9a4d
Lazily destroy protocol reader buffer
2011-04-03 18:04:15 +02:00
Pieter Noordhuis
921150fc8a
Individual reply object functions may be NULL
2011-04-03 17:46:59 +02:00
Pieter Noordhuis
8e2c39200d
Fix formatCommand to work with all empty interpolations
2011-03-06 11:38:07 +01:00
Pieter Noordhuis
2fc0d8756e
Use select(2) for enforce a timeout on blocking connect(2)
2011-02-04 15:26:28 +01:00
Pieter Noordhuis
663d6d1258
Properly reset state after protocol error in reply reader
2011-01-27 14:39:34 +01:00
Pieter Noordhuis
864bce944b
redisReplyReaderFeed should take a const char*
2011-01-27 14:07:06 +01:00
Pieter Noordhuis
fbe756d838
Avoid warnings with -Wstrict-prototypes
2011-01-27 12:50:55 +01:00
Pieter Noordhuis
3e8cbd53cf
Let sds.c figure out where the range stops
2011-01-19 18:10:27 +01:00
Pieter Noordhuis
f6a501001c
Discard consumed part of buffer less often
2011-01-19 18:01:01 +01:00
Pieter Noordhuis
43ab0f8018
Return error on socket timeout for a blocking context
2011-01-07 13:04:42 +01:00
Pieter Noordhuis
e3776bfaa6
Add function to explicitly free an async context
2010-12-28 19:19:25 +01:00
Pieter Noordhuis
a1e2c6dfed
Add myself to license in some files
2010-12-16 22:08:46 +01:00
Pieter Noordhuis
7684d556bd
Add (nearly) full printf support by delegating to vsprintf
2010-12-02 16:20:55 +01:00
Pieter Noordhuis
2635feb0ac
Wait with setting CONNECTED until there is an fd
2010-12-01 12:54:47 +01:00
Pieter Noordhuis
e73289a5c6
Use r->len in another spot
2010-11-26 15:25:19 +01:00
Pieter Noordhuis
4eab917a24
Use custom stroll
2010-11-26 14:48:04 +01:00
Pieter Noordhuis
f14108361b
Reply objects don't need to be calloc'ed
2010-11-26 14:47:01 +01:00
Pieter Noordhuis
5cf292cdd0
Use explicit buffer length field in the reply reader
2010-11-26 13:49:15 +01:00
Pieter Noordhuis
adb0895e99
Rename 'parent' field in read tasks to 'obj'
2010-11-26 13:04:42 +01:00
Pieter Noordhuis
b4dd17b57f
Remove leftover line from earlier commit
2010-11-24 15:46:50 +01:00
Pieter Noordhuis
257a9d40a9
Set error on unexpected nesting of multi bulks
2010-11-24 15:46:05 +01:00
Pieter Noordhuis
d4058be7b0
Add pointer to parent task in read tasks
2010-11-24 15:21:34 +01:00
Pieter Noordhuis
3d702d0bf1
Don't care if object returned by object function is NULL
2010-11-24 15:05:25 +01:00
Pieter Noordhuis
1927c643da
Add privdata field to reply reader
...
This field is set in the read tasks that are passed to the reply object
functions. This allows to curry arbitrary data to these functions.
2010-11-24 12:27:46 +01:00
Pieter Noordhuis
56bbeb7049
Abort on code path that should never be taken
2010-11-22 10:38:07 +01:00
Pieter Noordhuis
b6b96f776e
Make error messages consistent in casing
2010-11-22 10:37:14 +01:00
Pieter Noordhuis
cb89a472b6
Fix formatting literal percent characters
2010-11-22 10:00:45 +01:00
Pieter Noordhuis
9d9b8e1c79
Correctly format commands with empty interpolated values
2010-11-22 09:55:54 +01:00
Pieter Noordhuis
8ce0b3228d
Finding \r\n without strstr is a little harder
2010-11-04 23:52:47 +01:00
Pieter Noordhuis
8b616d3547
The buffer length to feed should be a size_t
2010-11-04 20:55:03 +01:00
Pieter Noordhuis
183220bf60
Make moveToNextTask non-recursive
2010-11-04 13:26:45 +01:00
Pieter Noordhuis
9c4ee606d6
Use strchr in a loop rather than strstr
2010-11-04 13:26:22 +01:00
Pieter Noordhuis
2e5e9a49fd
Return the reply type when the reply object function set is NULL
2010-11-04 13:15:44 +01:00
Pieter Noordhuis
f25a5267cc
Allow to connect using a unix socket from hiredis
2010-11-03 11:38:26 +01:00
Pieter Noordhuis
0ccb2c8d89
Add functiont to net.c to connect to a unix socket
2010-11-03 11:31:33 +01:00
Pieter Noordhuis
e13674dd4e
Expose redisGetReplyFromReader as public API
2010-11-03 00:40:07 +01:00
Pieter Noordhuis
e51ddd7c2c
Make setError receive an sds
2010-11-02 17:14:03 +01:00
Pieter Noordhuis
b8b296654d
Strip net.c down to the bare minimum
2010-11-02 17:09:26 +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
5fa8d30599
There is no longer need for a separate redisDisconnect
2010-11-01 14:20:51 +01:00
Pieter Noordhuis
ef995accb2
Strip non-blocking callbacks from hiredis.c
2010-11-01 14:13:03 +01:00
Pieter Noordhuis
435e545dd2
Fix redisGetReply
2010-10-31 21:11:25 +01:00
Pieter Noordhuis
6042c569b1
Move include of stdio.h to hiredis.h for size_t
2010-10-31 17:25:20 +01:00
Pieter Noordhuis
1d4f16b571
Extract OOM killer to util.h
2010-10-31 17:21:49 +01:00
Pieter Noordhuis
a0b9f04eaa
Move stdarg.h include to the hiredis header file
2010-10-31 14:45:15 +01:00
Pieter Noordhuis
44a2d08b30
The reply object functions may not change the read tasks
2010-10-31 14:44:36 +01:00
Pieter Noordhuis
3f0394b8a9
Use a fixed size stack instead of a dynamic list for read tasks
2010-10-31 14:42:48 +01:00
Pieter Noordhuis
f463734e91
Remove reply object functions from connect functions
2010-10-31 12:53:57 +01:00
Pieter Noordhuis
47e1f77149
Refactor internal function flow and add redisAppendCommand* family
2010-10-31 12:34:45 +01:00
Pieter Noordhuis
298e9325d7
First step in decoupling reply callbacks from internals
2010-10-31 10:56:24 +01:00
Pieter Noordhuis
a3a405bcba
Format a command using an argument vector
2010-10-31 10:34:29 +01:00
Pieter Noordhuis
e95c9d4c5b
Change redisFormatCommand to return the command in a char*
...
This allows users of the API to format a command without the need to
have all the sds functions included, only for free'ing the returned
wire-level command.
2010-10-30 20:38:29 +02:00
Pieter Noordhuis
bc5dcdbc85
Status replies should have type REDIS_REPLY_STATUS
2010-10-30 17:49:39 +02:00
Pieter Noordhuis
171b5a24d4
Drop dependency on sds.h for exposed API
2010-10-30 17:47:19 +02:00