summaryrefslogtreecommitdiffstats
path: root/server/red_channel.h
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2013-08-14 10:10:37 -0400
committerYonit Halperin <yhalperi@redhat.com>2013-08-14 13:35:10 -0400
commitc8b808bb8211e756a5e2280da173010984b71680 (patch)
tree29178b900fb41cb097cb92ca40b52a2d48b0ca65 /server/red_channel.h
parentd1e7142a0f90e2b977d2a73d26dc5b09d7771826 (diff)
downloadspice-c8b808bb8211e756a5e2280da173010984b71680.tar.gz
spice-c8b808bb8211e756a5e2280da173010984b71680.tar.xz
spice-c8b808bb8211e756a5e2280da173010984b71680.zip
red_channel: add option to monitor whether a channel client is alive
rhbz#994175 When a client connection is closed surprisingly (i.e., without a FIN segment), we cannot identify it by a socket error (which is the only way by which we identified disconnections so far). This patch allows a channel client to periodically check the state of the connection and identify surprise disconnections.
Diffstat (limited to 'server/red_channel.h')
-rw-r--r--server/red_channel.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/server/red_channel.h b/server/red_channel.h
index 1592896b..676e1ef5 100644
--- a/server/red_channel.h
+++ b/server/red_channel.h
@@ -236,6 +236,14 @@ typedef struct RedChannelClientLatencyMonitor {
int64_t roundtrip;
} RedChannelClientLatencyMonitor;
+typedef struct RedChannelClientConnectivityMonitor {
+ int state;
+ uint32_t out_bytes;
+ uint32_t in_bytes;
+ uint32_t timeout;
+ SpiceTimer *timer;
+} RedChannelClientConnectivityMonitor;
+
struct RedChannelClient {
RingItem channel_link;
RingItem client_link;
@@ -289,6 +297,7 @@ struct RedChannelClient {
int wait_migrate_flush_mark;
RedChannelClientLatencyMonitor latency_monitor;
+ RedChannelClientConnectivityMonitor connectivity_monitor;
};
struct RedChannel {
@@ -448,6 +457,11 @@ SpiceMarshaller *red_channel_client_switch_to_urgent_sender(RedChannelClient *rc
/* returns -1 if we don't have an estimation */
int red_channel_client_get_roundtrip_ms(RedChannelClient *rcc);
+/*
+ * Checks periodically if the connection is still alive
+ */
+void red_channel_client_start_connectivity_monitoring(RedChannelClient *rcc, uint32_t timeout_ms);
+
void red_channel_pipe_item_init(RedChannel *channel, PipeItem *item, int type);
// TODO: add back the channel_pipe_add functionality - by adding reference counting