[Spice-devel,v3,14/17] Make RedChannelClient::incoming private

Submitted by Frediano Ziglio on Nov. 29, 2016, 2:57 p.m.

Details

Message ID ab976a72e9d99771fe01839d73aab563199dc7da.1480431431.git-series.fziglio@redhat.com
State Superseded
Headers show
Series "Remove DummyChannel* objects" ( rev: 4 ) in Spice

Not browsing as part of any series.

Commit Message

Frediano Ziglio Nov. 29, 2016, 2:57 p.m.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
---
 server/red-channel-client-private.h | 11 +++++++++++
 server/red-channel-client.c         | 12 ++++++------
 server/red-channel-client.h         | 13 -------------
 3 files changed, 17 insertions(+), 19 deletions(-)

Patch hide | download patch | download mbox

diff --git a/server/red-channel-client-private.h b/server/red-channel-client-private.h
index 38759ff..5f31ed2 100644
--- a/server/red-channel-client-private.h
+++ b/server/red-channel-client-private.h
@@ -50,6 +50,16 @@  typedef struct OutgoingHandler {
     int size;
 } OutgoingHandler;
 
+typedef struct IncomingHandler {
+    IncomingHandlerInterface *cb;
+    void *opaque;
+    uint8_t header_buf[MAX_HEADER_SIZE];
+    SpiceDataHeaderOpaque header;
+    uint32_t header_pos;
+    uint8_t *msg; // data of the msg following the header. allocated by alloc_msg_buf.
+    uint32_t msg_pos;
+} IncomingHandler;
+
 struct RedChannelClientPrivate
 {
     RedChannel *channel;
@@ -99,6 +109,7 @@  struct RedChannelClientPrivate
     RedChannelClientLatencyMonitor latency_monitor;
     RedChannelClientConnectivityMonitor connectivity_monitor;
 
+    IncomingHandler incoming;
     OutgoingHandler outgoing;
 };
 
diff --git a/server/red-channel-client.c b/server/red-channel-client.c
index 24b2fb0..2b1843a 100644
--- a/server/red-channel-client.c
+++ b/server/red-channel-client.c
@@ -267,8 +267,8 @@  static void red_channel_client_constructed(GObject *object)
 {
     RedChannelClient *self =  RED_CHANNEL_CLIENT(object);
 
-    self->incoming.opaque = self;
-    self->incoming.cb = red_channel_get_incoming_handler(self->priv->channel);
+    self->priv->incoming.opaque = self;
+    self->priv->incoming.cb = red_channel_get_incoming_handler(self->priv->channel);
 
     self->priv->outgoing.opaque = self;
     self->priv->outgoing.cb = red_channel_get_outgoing_handler(self->priv->channel);
@@ -276,15 +276,15 @@  static void red_channel_client_constructed(GObject *object)
     self->priv->outgoing.size = 0;
 
     if (red_channel_client_test_remote_common_cap(self, SPICE_COMMON_CAP_MINI_HEADER)) {
-        self->incoming.header = mini_header_wrapper;
+        self->priv->incoming.header = mini_header_wrapper;
         self->priv->send_data.header = mini_header_wrapper;
         self->priv->is_mini_header = TRUE;
     } else {
-        self->incoming.header = full_header_wrapper;
+        self->priv->incoming.header = full_header_wrapper;
         self->priv->send_data.header = full_header_wrapper;
         self->priv->is_mini_header = FALSE;
     }
-    self->incoming.header.data = self->incoming.header_buf;
+    self->priv->incoming.header.data = self->priv->incoming.header_buf;
 }
 
 static void red_channel_client_class_init(RedChannelClientClass *klass)
@@ -1189,7 +1189,7 @@  static void red_peer_handle_incoming(RedsStream *stream, IncomingHandler *handle
 void red_channel_client_receive(RedChannelClient *rcc)
 {
     g_object_ref(rcc);
-    red_peer_handle_incoming(rcc->priv->stream, &rcc->incoming);
+    red_peer_handle_incoming(rcc->priv->stream, &rcc->priv->incoming);
     g_object_unref(rcc);
 }
 
diff --git a/server/red-channel-client.h b/server/red-channel-client.h
index 94b4f58..13ddf30 100644
--- a/server/red-channel-client.h
+++ b/server/red-channel-client.h
@@ -190,23 +190,10 @@  gboolean red_channel_client_set_migration_seamless(RedChannelClient *rcc);
 void red_channel_client_set_destroying(RedChannelClient *rcc);
 gboolean red_channel_client_is_destroying(RedChannelClient *rcc);
 
-typedef struct IncomingHandler {
-    IncomingHandlerInterface *cb;
-    void *opaque;
-    uint8_t header_buf[MAX_HEADER_SIZE];
-    SpiceDataHeaderOpaque header;
-    uint32_t header_pos;
-    uint8_t *msg; // data of the msg following the header. allocated by alloc_msg_buf.
-    uint32_t msg_pos;
-} IncomingHandler;
-
 struct RedChannelClient
 {
     GObject parent;
 
-    /* protected */
-    IncomingHandler incoming;
-
     RedChannelClientPrivate *priv;
 };