summaryrefslogtreecommitdiffstats
path: root/server/red_channel.c
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2013-08-14 09:38:12 -0400
committerYonit Halperin <yhalperi@redhat.com>2013-08-14 11:08:17 -0400
commitd1e7142a0f90e2b977d2a73d26dc5b09d7771826 (patch)
tree53e3b390bcd5610061877d3b3a9be5291b245dc1 /server/red_channel.c
parentc1c08c289883455f025836f14eda7bfd86442ed7 (diff)
downloadspice-d1e7142a0f90e2b977d2a73d26dc5b09d7771826.tar.gz
spice-d1e7142a0f90e2b977d2a73d26dc5b09d7771826.tar.xz
spice-d1e7142a0f90e2b977d2a73d26dc5b09d7771826.zip
red_channel: add on_input callback for tracing incoming bytes
The callback will be used in the next patch.
Diffstat (limited to 'server/red_channel.c')
-rw-r--r--server/red_channel.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/server/red_channel.c b/server/red_channel.c
index 37b0c1c6..bcf5a607 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -251,6 +251,7 @@ static void red_peer_handle_incoming(RedsStream *stream, IncomingHandler *handle
handler->cb->on_error(handler->opaque);
return;
}
+ handler->cb->on_input(handler->opaque, bytes_read);
handler->header_pos += bytes_read;
if (handler->header_pos != handler->header.header_size) {
@@ -278,6 +279,7 @@ static void red_peer_handle_incoming(RedsStream *stream, IncomingHandler *handle
handler->cb->on_error(handler->opaque);
return;
}
+ handler->cb->on_input(handler->opaque, bytes_read);
handler->msg_pos += bytes_read;
if (handler->msg_pos != msg_size) {
return;
@@ -390,6 +392,10 @@ static void red_channel_client_on_output(void *opaque, int n)
stat_inc_counter(rcc->channel->out_bytes_counter, n);
}
+static void red_channel_client_on_input(void *opaque, int n)
+{
+}
+
static void red_channel_client_default_peer_on_error(RedChannelClient *rcc)
{
red_channel_client_disconnect(rcc);
@@ -935,6 +941,7 @@ RedChannel *red_channel_create(int size,
channel->incoming_cb.handle_message = (handle_message_proc)handle_message;
channel->incoming_cb.on_error =
(on_incoming_error_proc)red_channel_client_default_peer_on_error;
+ channel->incoming_cb.on_input = red_channel_client_on_input;
channel->outgoing_cb.get_msg_size = red_channel_client_peer_get_out_msg_size;
channel->outgoing_cb.prepare = red_channel_client_peer_prepare_out_msg;
channel->outgoing_cb.on_block = red_channel_client_peer_on_out_block;