Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichael-grunder <michael.grunder@gmail.com>2020-09-15 05:30:08 +0300
committermichael-grunder <michael.grunder@gmail.com>2021-09-27 20:15:33 +0300
commitdfbbc8428a0f4e9bc92bb19624d6da1dcf46c3e7 (patch)
tree1d9ac3db6d836fea7bfdd65c22de8cd5db0aa771 /common.h
parentcb41edff5ac349cc390c72db62d5e44c7aca4824 (diff)
WIP: Experimental support to detect unconsumed data
This commit is an attempt at detecting unconsumed data on a socket when we pull it from the connection pool. Two new INI settings are introduced related to the changes: redis.pconnect.pool_detect_dirty: Value Explanation ----- ---------------------------------------------------------------- 0 Don't execute new logic at all. 1 Abort and close the socket if we find unconsumed bytes in the read buffer. 2 Seek to the end of our read buffer if we find unconsumed bytes and then poll the socket FD to detect if we're still readable in which case we fail and close the socket. redis.pconnect.pool_poll_timeout: The poll timeout to employ when checking if the socket is readable. This value is in milliseconds and can be zero.
Diffstat (limited to 'common.h')
-rw-r--r--common.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/common.h b/common.h
index 40266827..100b45eb 100644
--- a/common.h
+++ b/common.h
@@ -134,6 +134,17 @@ typedef enum {
#define MULTI 1
#define PIPELINE 2
+#define PHPREDIS_DEBUG_LOGGING 0
+
+#if PHPREDIS_DEBUG_LOGGING == 1
+#define redisDbgFmt(fmt, ...) \
+ php_printf("%s:%d:%s(): " fmt "\n", __FILE__, __LINE__, __func__, __VA_ARGS__)
+#define redisDbgStr(str) phpredisDebugFmt("%s", str)
+#else
+#define redisDbgFmt(fmt, ...) ((void)0)
+#define redisDbgStr(str) ((void)0)
+#endif
+
#define IS_ATOMIC(redis_sock) (redis_sock->mode == ATOMIC)
#define IS_MULTI(redis_sock) (redis_sock->mode & MULTI)
#define IS_PIPELINE(redis_sock) (redis_sock->mode & PIPELINE)