summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathon Jongsma <jjongsma@redhat.com>2015-01-16 14:44:03 -0600
committerFabiano FidĂȘncio <fidencio@redhat.com>2015-02-23 23:00:42 +0100
commit31eef48361e9bd2a937fb82c14baf6924e4c9d6f (patch)
treebd30beafd52c4ccf92b44ff83be3bdafc327b28d
parent93f9cf5c2c2c6f224f052c3f64a409511568ce6a (diff)
downloadspice-31eef48361e9bd2a937fb82c14baf6924e4c9d6f.tar.gz
spice-31eef48361e9bd2a937fb82c14baf6924e4c9d6f.tar.xz
spice-31eef48361e9bd2a937fb82c14baf6924e4c9d6f.zip
Change vdi_port_read_buf_unref() to take RedsState arg
-rw-r--r--server/reds.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/server/reds.c b/server/reds.c
index f8fa1cb7..6a18a557 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -158,7 +158,7 @@ static void reds_send_mm_time(void);
static VDIReadBuf *vdi_port_read_buf_get(RedsState *reds);
static VDIReadBuf *vdi_port_read_buf_ref(VDIReadBuf *buf);
-static void vdi_port_read_buf_unref(VDIReadBuf *buf);
+static void vdi_port_read_buf_unref(RedsState *reds, VDIReadBuf *buf);
static ChannelSecurityOptions *channels_security = NULL;
static int default_channel_security =
@@ -385,7 +385,7 @@ static void reds_reset_vdp(RedsState *reds)
state->receive_len = sizeof(state->vdi_chunk_header);
state->message_receive_len = 0;
if (state->current_read_buf) {
- vdi_port_read_buf_unref(state->current_read_buf);
+ vdi_port_read_buf_unref(reds, state->current_read_buf);
state->current_read_buf = NULL;
}
/* Reset read filter to start with clean state when the agent reconnects */
@@ -603,7 +603,7 @@ static void vdi_port_read_buf_release(uint8_t *data, void *opaque)
{
VDIReadBuf *buf = (VDIReadBuf *)opaque;
- vdi_port_read_buf_unref(buf);
+ vdi_port_read_buf_unref(reds, buf);
}
/* returns TRUE if the buffer can be forwarded */
@@ -658,7 +658,9 @@ static VDIReadBuf* vdi_port_read_buf_ref(VDIReadBuf *buf)
return buf;
}
-static void vdi_port_read_buf_unref(VDIReadBuf *buf)
+/* FIXME: refactor so that unreffing the VDIReadBuf doesn't require accessing
+ * RedsState? */
+static void vdi_port_read_buf_unref(RedsState *reds, VDIReadBuf *buf)
{
if (!--buf->refs) {
ring_add(&reds->agent_state.read_bufs, &buf->link);
@@ -734,7 +736,7 @@ static SpiceCharDeviceMsgToClient *vdi_port_read_one_msg_from_device(SpiceCharDe
if (vdi_port_read_buf_process(reds, state->vdi_chunk_header.port, dispatch_buf)) {
return dispatch_buf;
} else {
- vdi_port_read_buf_unref(dispatch_buf);
+ vdi_port_read_buf_unref(reds, dispatch_buf);
}
} /* END switch */
} /* END while */
@@ -750,7 +752,7 @@ static SpiceCharDeviceMsgToClient *vdi_port_ref_msg_to_client(SpiceCharDeviceMsg
static void vdi_port_unref_msg_to_client(SpiceCharDeviceMsgToClient *msg,
void *opaque)
{
- vdi_port_read_buf_unref(msg);
+ vdi_port_read_buf_unref(reds, msg);
}
/* after calling this, we unref the message, and the ref is in the instance side */
@@ -1107,7 +1109,7 @@ void reds_on_main_channel_migrate(MainChannelClient *mcc)
vdi_port_read_buf_release,
read_buf);
} else {
- vdi_port_read_buf_unref(read_buf);
+ vdi_port_read_buf_unref(reds, read_buf);
}
spice_assert(agent_state->receive_len);