diff options
author | Aaron Isotton <aaronisotton@google.com> | 2016-02-26 11:53:22 -0800 |
---|---|---|
committer | Aaron Isotton <aaronisotton@google.com> | 2016-03-08 14:21:31 -0800 |
commit | 24e69bf02afb0f4abdd637d1513e93e5aa227e7e (patch) | |
tree | 0d8cb64c15f1d96ef83cebab98a2ff0cd7c63cc4 /test/core/util | |
parent | 0e67d191267aa9bb641bbeaf11246878c3521e75 (diff) |
Added a channel argument to set the maximum reconnect backoff duration. Extended the interop test to test the custom reconnect backoffs.
This closes #5377.
Diffstat (limited to 'test/core/util')
-rw-r--r-- | test/core/util/reconnect_server.c | 9 | ||||
-rw-r--r-- | test/core/util/reconnect_server.h | 3 |
2 files changed, 9 insertions, 3 deletions
diff --git a/test/core/util/reconnect_server.c b/test/core/util/reconnect_server.c index 57225aa8a3..bab34d8e5b 100644 --- a/test/core/util/reconnect_server.c +++ b/test/core/util/reconnect_server.c @@ -60,8 +60,12 @@ static void pretty_print_backoffs(reconnect_server *server) { i, backoff / 1000.0, expected_backoff / 1000.0, (backoff - expected_backoff) * 100.0 / expected_backoff); expected_backoff *= 1.6; - if (expected_backoff > 120 * 1000) { - expected_backoff = 120 * 1000; + int max_reconnect_backoff_ms = 120 * 1000; + if (server->max_reconnect_backoff_ms > 0) { + max_reconnect_backoff_ms = server->max_reconnect_backoff_ms; + } + if (expected_backoff > max_reconnect_backoff_ms) { + expected_backoff = max_reconnect_backoff_ms; } } } @@ -108,6 +112,7 @@ void reconnect_server_init(reconnect_server *server) { server->head = NULL; server->tail = NULL; server->peer = NULL; + server->max_reconnect_backoff_ms = 0; } void reconnect_server_start(reconnect_server *server, int port) { diff --git a/test/core/util/reconnect_server.h b/test/core/util/reconnect_server.h index e2e6a02461..ed02d49512 100644 --- a/test/core/util/reconnect_server.h +++ b/test/core/util/reconnect_server.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -52,6 +52,7 @@ typedef struct reconnect_server { timestamp_list *head; timestamp_list *tail; char *peer; + int max_reconnect_backoff_ms; } reconnect_server; void reconnect_server_init(reconnect_server *server); |