|
|
6ba27a |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
6ba27a |
From: Frediano Ziglio <fziglio@redhat.com>
|
|
|
6ba27a |
Date: Thu, 14 Nov 2019 15:18:29 +0000
|
|
|
6ba27a |
Subject: [PATCH 2/2] red-channel-client: Always enable latency monitor to keep
|
|
|
6ba27a |
tcp connection alive
|
|
|
6ba27a |
|
|
|
6ba27a |
Create some traffic on the connection to avoid potential timeout
|
|
|
6ba27a |
on some proxies implementation which require some TCP data traffic.
|
|
|
6ba27a |
The timeout used by default is quite big (5 minutes) to reduce network
|
|
|
6ba27a |
traffic.
|
|
|
6ba27a |
In case connectivity monitoring is enabled or latency monitor is
|
|
|
6ba27a |
requested the timeout is reduced to the old default.
|
|
|
6ba27a |
|
|
|
6ba27a |
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
|
|
|
6ba27a |
---
|
|
|
6ba27a |
server/red-channel-client.c | 18 +++++++++++-------
|
|
|
6ba27a |
1 file changed, 11 insertions(+), 7 deletions(-)
|
|
|
6ba27a |
|
|
|
6ba27a |
diff --git a/server/red-channel-client.c b/server/red-channel-client.c
|
|
|
6ba27a |
index 3cc6a70..7be382e 100644
|
|
|
6ba27a |
--- a/server/red-channel-client.c
|
|
|
6ba27a |
+++ b/server/red-channel-client.c
|
|
|
6ba27a |
@@ -210,6 +210,7 @@ enum {
|
|
|
6ba27a |
};
|
|
|
6ba27a |
|
|
|
6ba27a |
#define PING_TEST_TIMEOUT_MS (MSEC_PER_SEC * 15)
|
|
|
6ba27a |
+#define PING_TEST_LONG_TIMEOUT_MS (MSEC_PER_SEC * 60 * 5)
|
|
|
6ba27a |
#define PING_TEST_IDLE_NET_TIMEOUT_MS (MSEC_PER_SEC / 10)
|
|
|
6ba27a |
|
|
|
6ba27a |
typedef struct RedEmptyMsgPipeItem {
|
|
|
6ba27a |
@@ -808,11 +809,13 @@ void red_channel_client_start_connectivity_monitoring(RedChannelClient *rcc, uin
|
|
|
6ba27a |
if (rcc->priv->latency_monitor.timer == NULL) {
|
|
|
6ba27a |
rcc->priv->latency_monitor.timer = core->timer_add(
|
|
|
6ba27a |
core, red_channel_client_ping_timer, rcc);
|
|
|
6ba27a |
- if (!red_client_during_migrate_at_target(rcc->priv->client)) {
|
|
|
6ba27a |
- red_channel_client_start_ping_timer(rcc, PING_TEST_IDLE_NET_TIMEOUT_MS);
|
|
|
6ba27a |
- }
|
|
|
6ba27a |
rcc->priv->latency_monitor.roundtrip = -1;
|
|
|
6ba27a |
- rcc->priv->latency_monitor.timeout = PING_TEST_TIMEOUT_MS;
|
|
|
6ba27a |
+ } else {
|
|
|
6ba27a |
+ red_channel_client_cancel_ping_timer(rcc);
|
|
|
6ba27a |
+ }
|
|
|
6ba27a |
+ rcc->priv->latency_monitor.timeout = PING_TEST_TIMEOUT_MS;
|
|
|
6ba27a |
+ if (!red_client_during_migrate_at_target(rcc->priv->client)) {
|
|
|
6ba27a |
+ red_channel_client_start_ping_timer(rcc, PING_TEST_IDLE_NET_TIMEOUT_MS);
|
|
|
6ba27a |
}
|
|
|
6ba27a |
if (rcc->priv->connectivity_monitor.timer == NULL) {
|
|
|
6ba27a |
rcc->priv->connectivity_monitor.state = CONNECTIVITY_STATE_CONNECTED;
|
|
|
6ba27a |
@@ -948,8 +951,7 @@ static gboolean red_channel_client_initable_init(GInitable *initable,
|
|
|
6ba27a |
red_channel_client_event,
|
|
|
6ba27a |
self);
|
|
|
6ba27a |
|
|
|
6ba27a |
- if (self->priv->monitor_latency
|
|
|
6ba27a |
- && reds_stream_get_family(self->priv->stream) != AF_UNIX) {
|
|
|
6ba27a |
+ if (reds_stream_get_family(self->priv->stream) != AF_UNIX) {
|
|
|
6ba27a |
self->priv->latency_monitor.timer =
|
|
|
6ba27a |
core->timer_add(core, red_channel_client_ping_timer, self);
|
|
|
6ba27a |
|
|
|
6ba27a |
@@ -958,7 +960,8 @@ static gboolean red_channel_client_initable_init(GInitable *initable,
|
|
|
6ba27a |
PING_TEST_IDLE_NET_TIMEOUT_MS);
|
|
|
6ba27a |
}
|
|
|
6ba27a |
self->priv->latency_monitor.roundtrip = -1;
|
|
|
6ba27a |
- self->priv->latency_monitor.timeout = PING_TEST_TIMEOUT_MS;
|
|
|
6ba27a |
+ self->priv->latency_monitor.timeout =
|
|
|
6ba27a |
+ self->priv->monitor_latency ? PING_TEST_TIMEOUT_MS : PING_TEST_LONG_TIMEOUT_MS;
|
|
|
6ba27a |
}
|
|
|
6ba27a |
|
|
|
6ba27a |
red_channel_add_client(self->priv->channel, self);
|