summaryrefslogtreecommitdiff
path: root/src/connection.h
diff options
context:
space:
mode:
authorzhenwei pi <pizhenwei@bytedance.com>2022-07-27 10:39:49 +0800
committerzhenwei pi <pizhenwei@bytedance.com>2022-08-22 15:11:06 +0800
commit709b55b09dee2d22ae306d00b2c9ead1d382c044 (patch)
treeb84bb4989b008a25ee6353e90f472450f897431e /src/connection.h
parent8234a5123d8727a0b72c7b1a2524edd113ffe016 (diff)
downloadredis-709b55b09dee2d22ae306d00b2c9ead1d382c044.tar.gz
Introduce pending data for connection type
Introduce .has_pending_data and .process_pending_data for connection type, and hide tlsHasPendingData() and tlsProcessPendingData(). Also set .has_pending_data and .process_pending_data as NULL explicitly in socket.c. Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Diffstat (limited to 'src/connection.h')
-rw-r--r--src/connection.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/connection.h b/src/connection.h
index b3eb6cc20..dac4dc3ea 100644
--- a/src/connection.h
+++ b/src/connection.h
@@ -91,6 +91,10 @@ typedef struct ConnectionType {
ssize_t (*sync_write)(struct connection *conn, char *ptr, ssize_t size, long long timeout);
ssize_t (*sync_read)(struct connection *conn, char *ptr, ssize_t size, long long timeout);
ssize_t (*sync_readline)(struct connection *conn, char *ptr, ssize_t size, long long timeout);
+
+ /* pending data */
+ int (*has_pending_data)(void);
+ int (*process_pending_data)(void);
} ConnectionType;
struct connection {
@@ -332,8 +336,6 @@ int connRecvTimeout(connection *conn, long long ms);
/* Helpers for tls special considerations */
sds connTLSGetPeerCert(connection *conn);
-int tlsHasPendingData();
-int tlsProcessPendingData();
/* Initialize the redis connection framework */
int connTypeInitialize();
@@ -352,6 +354,12 @@ void connTypeCleanup(int type);
/* Walk all the connection type, and cleanup them all if possible */
void connTypeCleanupAll();
+/* Test all the connection type has pending data or not. */
+int connTypeHasPendingData(void);
+
+/* walk all the connection types and process pending data for each connection type */
+int connTypeProcessPendingData(void);
+
int RedisRegisterConnectionTypeSocket();
int RedisRegisterConnectionTypeTLS();