Commit Graph

816 Commits

Author SHA1 Message Date
Pieter Noordhuis
e3067fe231 Actively disconnect on an error
This calls the disconnect callback, causing the registered event
handlers to be cleared. After this, the error callback will be called,
knowing that events will no longer be fired.
2010-10-19 21:24:30 +02:00
Pieter Noordhuis
947612865d Remove const qualifier from command callback in examples 2010-10-19 21:24:30 +02:00
Pieter Noordhuis
d4b4a9128e Revert e5dd32d8 that added the const qualifier for command callbacks 2010-10-19 21:24:30 +02:00
Pieter Noordhuis
c8d72f7c7a Style 2010-10-19 21:24:30 +02:00
Pieter Noordhuis
e245ab48ec Added header file and example for usage from libev 2010-10-19 21:24:24 +02:00
Pieter Noordhuis
206868de06 Make error callback argument const 2010-10-19 16:48:19 +02:00
Pieter Noordhuis
ba42ab2ef8 Revert privdata in context callbacks to being non-const 2010-10-19 14:19:51 +02:00
Pieter Noordhuis
f9596db90b Test callback sequence in non-blocking context 2010-10-18 16:27:52 +02:00
Pieter Noordhuis
e332a32b35 Change redisWriteBuffer to return OK on an empty buffer 2010-10-18 15:49:52 +02:00
Pieter Noordhuis
a68cb9686e Tests for context callbacks in non-blocking mode 2010-10-18 15:39:56 +02:00
Pieter Noordhuis
634314f386 Rearrange tests to isolated functions 2010-10-18 14:51:03 +02:00
Pieter Noordhuis
61ba85ce57 Move context callbacks into struct and make privdata const 2010-10-18 12:37:33 +02:00
Pieter Noordhuis
7496458c68 The QUIT commands returns OK on master 2010-10-18 12:01:17 +02:00
Pieter Noordhuis
8b8b7afef2 Change README to Markdown 2010-10-12 00:31:09 +02:00
Pieter Noordhuis
3dfacba4f7 Add comments for function prototypes in hiredis.h 2010-10-12 00:27:04 +02:00
Pieter Noordhuis
d89241e795 Include sys/types.h instead of a custom typedef 2010-10-11 18:34:32 +02:00
Pieter Noordhuis
a7acd97ad1 Move event_base code out of libevent.h
This removes the need to wrap an event_base pointer in the redisContext
struct and allows multiple connections to be used in a single
event_base. Also, use the *privdata argument to the provided callbacks
to curry the redisEvent struct around.
2010-10-11 18:33:15 +02:00
Nicolas Favre-Felix
135e9265ac Added event_base to libevent code. 2010-10-10 20:51:27 +02:00
Pieter Noordhuis
96510ce86a Factor out reusable include for libevent 2010-10-07 17:48:03 +02:00
Pieter Noordhuis
b60952f22a Disconnect before free'ing 2010-10-07 17:38:56 +02:00
Pieter Noordhuis
9cd3b03d84 Fire callback when the context is being disconnected by the user 2010-10-07 17:36:22 +02:00
Pieter Noordhuis
e5dd32d809 Add const qualifier to privdata pointer for command callbacks 2010-10-07 17:35:31 +02:00
Pieter Noordhuis
5c7b5fca4d Make error messages more consistent (e.g. no newline) 2010-10-06 21:23:03 +02:00
Pieter Noordhuis
1a5f111d52 c->error is no longer a redisReply object, but rather a plain C-string 2010-10-06 21:10:09 +02:00
Pieter Noordhuis
97920b443e Rename variables 2010-10-06 18:13:23 +02:00
Pieter Noordhuis
5a38356cc4 Add example for non-blocking usage of hiredis with libevent 2010-09-25 22:34:22 +02:00
Pieter Noordhuis
1c245845ed Trigger callbacks when a command is issued or the context is free'd 2010-09-25 22:31:07 +02:00
Pieter Noordhuis
8345467b2e Free the replies after the tests are done 2010-09-25 15:33:46 +02:00
Pieter Noordhuis
9e417047ed Add function to free an allocated context 2010-09-25 15:33:27 +02:00
Pieter Noordhuis
cab99f6427 Free command before returning 2010-09-25 15:26:34 +02:00
Pieter Noordhuis
bc3ec0f35a Rename HIREDIS_BLOCK to REDIS_BLOCK 2010-09-25 15:11:59 +02:00
Pieter Noordhuis
a7d7618141 Deprecate the error object for I/O and protocol errors
Rather, use the return value REDIS_OK and REDIS_ERR to designate if
calling a function has a successful outcome. When there was an error in
performing the call the error field will be set inside the reader or the
context.
2010-09-25 15:09:13 +02:00
Pieter Noordhuis
e6fb160b44 Rename defines HIREDIS_* to REDIS_* 2010-09-25 12:06:47 +02:00
Pieter Noordhuis
bb668e1b94 Support callback functions in a non-blocking context 2010-09-25 12:06:00 +02:00
Pieter Noordhuis
de9c172b50 Fix comment 2010-09-25 11:07:17 +02:00
Pieter Noordhuis
d156550886 Rename fd to the more appropriate c 2010-09-24 18:48:07 +02:00
Pieter Noordhuis
817d26b81d Use context variable to keep state for a connection
The context supports both blocking and non-blocking connections. All
read and write events are not handled by hiredis, but hiredis exposes an
API for buffered reading/writing to Redis.
2010-09-24 18:42:22 +02:00
Pieter Noordhuis
81f6b8ffd4 Split redisCommand to a more generic function 2010-09-24 18:42:21 +02:00
Pieter Noordhuis
510bbf1721 Make target for building static library 2010-09-21 14:05:22 +02:00
Pieter Noordhuis
af8ba74cbf Rename functions to be more consistent, split feed from get reply 2010-09-21 11:39:18 +02:00
Pieter Noordhuis
b1bedf5c6d Use a set of function pointers for building the reply
Allows libraries to wrap the reply parsing code and build the reply in a
streaming fashion. Reply objects can immediately be initialized to the
required type without having to convert an intermediary format.
2010-09-20 22:04:35 +02:00
Pieter Noordhuis
0a6e3b38e7 Add context to createErrorObject 2010-09-20 18:18:25 +02:00
Pieter Noordhuis
db5244045c Introduce read tasks to allow hooking other code into reply parsing 2010-09-20 18:02:28 +02:00
Pieter Noordhuis
b1fa529cf9 Add function to check if the reply reader is empty 2010-09-20 15:26:18 +02:00
Pieter Noordhuis
e944ea3662 Add reply type for protocol errors, in order to never exit() 2010-09-20 14:05:23 +02:00
Pieter Noordhuis
aec1fbd2ad Use automatic numbering in tests 2010-09-20 13:44:24 +02:00
Pieter Noordhuis
3253105d49 Update sds code 2010-09-20 13:19:13 +02:00
Pieter Noordhuis
e621f31306 Expose API for streaming bytes to a reply 2010-09-20 09:50:19 +02:00
Pieter Noordhuis
4ec97f5907 Free reply in test.c to make hiredis-test run cleanly on Valgrind 2010-09-19 20:43:57 +02:00
Pieter Noordhuis
f87625777d Change function prototype 2010-09-19 20:43:43 +02:00