summaryrefslogtreecommitdiff
path: root/test.c
diff options
context:
space:
mode:
authorMichael Grunder <michael.grunder@gmail.com>2022-09-03 12:39:57 -0700
committerGitHub <noreply@github.com>2022-09-03 12:39:57 -0700
commit61b5b299f0ac4f0efbe11a45716e06a9c35f37b7 (patch)
treeaa27e6e89ac46f0fc8f1032c488924f47fcfeedc /test.c
parentfce8abc1c19ab731f5c84797aa71b4d49921913f (diff)
Use a windows specific keepalive function. (#1104)
Use a windows specific keepalive function. While it is possible to toggle `TCP_KEEPALIVE` in windows via setsockopt, you have to use `WSAIoctl` to set the interval. Since `WSAIoctl` can actually do all of this in one call (toggle the option, and set the corresponding interval), just use that in Windows and avoid the call to `setsockopt` alltogether. Fixes: #1100
Diffstat (limited to 'test.c')
-rw-r--r--test.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/test.c b/test.c
index e4aad54..fe9b478 100644
--- a/test.c
+++ b/test.c
@@ -405,6 +405,16 @@ static void test_append_formatted_commands(struct config config) {
disconnect(c, 0);
}
+static void test_tcp_options(struct config cfg) {
+ redisContext *c;
+
+ c = do_connect(cfg);
+ test("We can enable TCP_KEEPALIVE: ");
+ test_cond(redisEnableKeepAlive(c) == REDIS_OK);
+
+ disconnect(c, 0);
+}
+
static void test_reply_reader(void) {
redisReader *reader;
void *reply, *root;
@@ -2261,6 +2271,7 @@ int main(int argc, char **argv) {
test_blocking_io_errors(cfg);
test_invalid_timeout_errors(cfg);
test_append_formatted_commands(cfg);
+ test_tcp_options(cfg);
if (throughput) test_throughput(cfg);
printf("\nTesting against Unix socket connection (%s): ", cfg.unix_sock.path);