summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2010-07-22 00:40:41 +0300
committerAlon Levy <alevy@redhat.com>2010-07-22 11:14:26 +0300
commitc44b6acb09c195979266d44d3bbd9dab88e4b71c (patch)
treed647c597655aff74edfc7070fe44742fb47cc446 /server
parente24d2094a4d0651a20a99b1197afe1083489e46e (diff)
downloadspice-c44b6acb09c195979266d44d3bbd9dab88e4b71c.tar.gz
spice-c44b6acb09c195979266d44d3bbd9dab88e4b71c.tar.xz
spice-c44b6acb09c195979266d44d3bbd9dab88e4b71c.zip
server: add vdi_port write retry timer. RHBZ 616772
Diffstat (limited to 'server')
-rw-r--r--server/reds.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/server/reds.c b/server/reds.c
index 03003341..b7c6ce7d 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -106,6 +106,7 @@ static void openssl_init();
#define KEY_MODIFIERS_TTL (1000 * 2) /*2sec*/
#define MM_TIMER_GRANULARITY_MS (1000 / 30)
#define MM_TIME_DELTA 400 /*ms*/
+#define VDI_PORT_WRITE_RETRY_TIMEOUT 100 /*ms*/
// approximate max receive message size
#define RECIVE_BUF_SIZE \
@@ -279,6 +280,8 @@ typedef struct RedsState {
SpiceTimer *mig_timer;
SpiceTimer *key_modifiers_timer;
SpiceTimer *mm_timer;
+ SpiceTimer *vdi_port_write_timer;
+ int vdi_port_write_timer_started;
TicketAuthentication taTicket;
SSL_CTX *ctx;
@@ -1127,6 +1130,24 @@ static void reds_send_tokens()
reds_push_pipe_item(item);
}
+static int write_to_vdi_port();
+
+static void vdi_port_write_timer_start()
+{
+ if (reds->vdi_port_write_timer_started) {
+ return;
+ }
+ reds->vdi_port_write_timer_started = TRUE;
+ core->timer_start(reds->vdi_port_write_timer,
+ VDI_PORT_WRITE_RETRY_TIMEOUT);
+}
+
+static void vdi_port_write_retry()
+{
+ write_to_vdi_port();
+ reds->vdi_port_write_timer_started = FALSE;
+}
+
static int write_to_vdi_port()
{
VDIPortState *state = &reds->agent_state;
@@ -1159,6 +1180,10 @@ static int write_to_vdi_port()
}
buf->now += n;
}
+ // Workaround for lack of proper sif write_possible callback (RHBZ 616772)
+ if (ring_item != NULL) {
+ vdi_port_write_timer_start();
+ }
return total;
}
@@ -3635,6 +3660,11 @@ static void do_spice_init(SpiceCoreInterface *core_interface)
if (!(reds->key_modifiers_timer = core->timer_add(key_modifiers_sender, NULL))) {
red_error("key modifiers timer create failed");
}
+ if (!(reds->vdi_port_write_timer = core->timer_add(vdi_port_write_retry, NULL)))
+ {
+ red_error("vdi port write timer create failed");
+ }
+ reds->vdi_port_write_timer_started = FALSE;
#ifdef RED_STATISTICS
int shm_name_len = strlen(SPICE_STAT_SHM_NAME) + 20;