[Spice-commits] 2 commits - server/red-channel-client.c
Frediano Ziglio
fziglio at kemper.freedesktop.org
Wed Feb 15 10:04:38 UTC 2017
server/red-channel-client.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
New commits:
commit f603f17317b62cae561438a9cae064373b6e41ce
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri Feb 10 10:57:01 2017 +0000
red-channel-client: Pass array size to red_channel_client_prepare_out_msg
Do not make it assume vec contains IOV_MAX elements.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/red-channel-client.c b/server/red-channel-client.c
index 6cdc4e1..9ab22e4 100644
--- a/server/red-channel-client.c
+++ b/server/red-channel-client.c
@@ -495,12 +495,12 @@ static int red_channel_client_get_out_msg_size(RedChannelClient *rcc)
return rcc->priv->send_data.size;
}
-static void red_channel_client_prepare_out_msg(RedChannelClient *rcc,
- struct iovec *vec, int *vec_size,
- int pos)
+static int red_channel_client_prepare_out_msg(RedChannelClient *rcc,
+ struct iovec *vec, int vec_size,
+ int pos)
{
- *vec_size = spice_marshaller_fill_iovec(rcc->priv->send_data.marshaller,
- vec, IOV_MAX, pos);
+ return spice_marshaller_fill_iovec(rcc->priv->send_data.marshaller,
+ vec, vec_size, pos);
}
static void red_channel_client_set_blocked(RedChannelClient *rcc)
@@ -1129,7 +1129,9 @@ static void red_channel_client_handle_outgoing(RedChannelClient *rcc)
}
for (;;) {
- red_channel_client_prepare_out_msg(rcc, buffer->vec, &buffer->vec_size, buffer->pos);
+ buffer->vec_size =
+ red_channel_client_prepare_out_msg(rcc, buffer->vec, G_N_ELEMENTS(buffer->vec),
+ buffer->pos);
n = reds_stream_writev(stream, buffer->vec, buffer->vec_size);
if (n == -1) {
switch (errno) {
commit 317457221dd60c51bb3cf38c9b29ecd024e38bde
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri Feb 10 10:48:25 2017 +0000
red-channel-client: Remove vec field from OutgoingHandler
This was always set to vec_buf.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/red-channel-client.c b/server/red-channel-client.c
index 9f48660..6cdc4e1 100644
--- a/server/red-channel-client.c
+++ b/server/red-channel-client.c
@@ -79,9 +79,8 @@ typedef struct RedChannelClientConnectivityMonitor {
} RedChannelClientConnectivityMonitor;
typedef struct OutgoingMessageBuffer {
- struct iovec vec_buf[IOV_MAX];
+ struct iovec vec[IOV_MAX];
int vec_size;
- struct iovec *vec;
int pos;
int size;
} OutgoingMessageBuffer;
@@ -1123,7 +1122,6 @@ static void red_channel_client_handle_outgoing(RedChannelClient *rcc)
}
if (buffer->size == 0) {
- buffer->vec = buffer->vec_buf;
buffer->size = red_channel_client_get_out_msg_size(rcc);
if (!buffer->size) { // nothing to be sent
return;
@@ -1155,7 +1153,6 @@ static void red_channel_client_handle_outgoing(RedChannelClient *rcc)
/* reset buffer before calling on_msg_done, since it
* can trigger another call to red_channel_client_handle_outgoing (when
* switching from the urgent marshaller to the main one */
- buffer->vec = buffer->vec_buf;
buffer->pos = 0;
buffer->size = 0;
red_channel_client_msg_sent(rcc);
More information about the Spice-commits
mailing list