[Spice-commits] 3 commits - server/red-channel-client.c server/red-channel-client.h
Frediano Ziglio
fziglio at kemper.freedesktop.org
Wed Feb 15 16:54:35 UTC 2017
server/red-channel-client.c | 52 ++++++++++++++++++++++----------------------
server/red-channel-client.h | 28 -----------------------
2 files changed, 27 insertions(+), 53 deletions(-)
New commits:
commit 4838f317a9c0e7a69ec771264bd4b5d85c85f228
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Tue Feb 14 21:05:57 2017 +0000
rcc: Make some functions/macros private
Some constants/macros/function prototypes are defined in
red-channel-client.h while they are only used by red-channel-client.c.
This commit moves them to the .c file to make them private.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
diff --git a/server/red-channel-client.c b/server/red-channel-client.c
index 16e5446..a0e213f 100644
--- a/server/red-channel-client.c
+++ b/server/red-channel-client.c
@@ -37,6 +37,14 @@
#include "red-client.h"
#include "glib-compat.h"
+#define CLIENT_ACK_WINDOW 20
+
+#define MAX_HEADER_SIZE sizeof(SpiceDataHeader)
+
+#ifndef IOV_MAX
+#define IOV_MAX 1024
+#endif
+
typedef struct SpiceDataHeaderOpaque SpiceDataHeaderOpaque;
typedef uint16_t (*get_msg_type_proc)(SpiceDataHeaderOpaque *header);
@@ -147,6 +155,21 @@ static const SpiceDataHeaderOpaque mini_header_wrapper;
static void red_channel_client_clear_sent_item(RedChannelClient *rcc);
static void red_channel_client_destroy_remote_caps(RedChannelClient* rcc);
static void red_channel_client_initable_interface_init(GInitableIface *iface);
+static void red_channel_client_set_message_serial(RedChannelClient *channel, uint64_t);
+
+/*
+ * When an error occurs over a channel, we treat it as a warning
+ * for spice-server and shutdown the channel.
+ */
+#define spice_channel_client_error(rcc, format, ...) \
+ do { \
+ RedChannel *_ch = red_channel_client_get_channel(rcc); \
+ uint32_t _type, _id; \
+ g_object_get(_ch, "channel-type", &_type, "id", &_id, NULL); \
+ spice_warning("rcc %p type %u id %u: " format, rcc, \
+ type, id, ## __VA_ARGS__); \
+ red_channel_client_shutdown(rcc); \
+ } while (0)
G_DEFINE_TYPE_WITH_CODE(RedChannelClient, red_channel_client, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE(G_TYPE_INITABLE,
@@ -1568,7 +1591,7 @@ uint64_t red_channel_client_get_message_serial(RedChannelClient *rcc)
return rcc->priv->send_data.last_sent_serial + 1;
}
-void red_channel_client_set_message_serial(RedChannelClient *rcc, uint64_t serial)
+static void red_channel_client_set_message_serial(RedChannelClient *rcc, uint64_t serial)
{
rcc->priv->send_data.last_sent_serial = serial - 1;
}
diff --git a/server/red-channel-client.h b/server/red-channel-client.h
index 1b0b810..474a5cd 100644
--- a/server/red-channel-client.h
+++ b/server/red-channel-client.h
@@ -20,7 +20,6 @@
#include <glib-object.h>
#include <gio/gio.h>
-#include <spice/protocol.h>
#include <common/marshaller.h>
#include "red-pipe-item.h"
@@ -29,13 +28,6 @@
G_BEGIN_DECLS
-#define MAX_HEADER_SIZE sizeof(SpiceDataHeader)
-#define CLIENT_ACK_WINDOW 20
-
-#ifndef IOV_MAX
-#define IOV_MAX 1024
-#endif
-
#define RED_TYPE_CHANNEL_CLIENT red_channel_client_get_type()
#define RED_CHANNEL_CLIENT(obj) \
@@ -55,20 +47,6 @@ typedef struct RedChannelClientPrivate RedChannelClientPrivate;
GType red_channel_client_get_type(void) G_GNUC_CONST;
-/*
- * When an error occurs over a channel, we treat it as a warning
- * for spice-server and shutdown the channel.
- */
-#define spice_channel_client_error(rcc, format, ...) \
- do { \
- RedChannel *_ch = red_channel_client_get_channel(rcc); \
- uint32_t _type, _id; \
- g_object_get(_ch, "channel-type", &_type, "id", &_id, NULL); \
- spice_warning("rcc %p type %u id %u: " format, rcc, \
- type, id, ## __VA_ARGS__); \
- red_channel_client_shutdown(rcc); \
- } while (0)
-
RedChannelClient *red_channel_client_create(RedChannel *channel,
RedClient *client, RedsStream *stream,
int monitor_latency,
@@ -92,7 +70,6 @@ int red_channel_client_handle_message(RedChannelClient *rcc, uint16_t type,
void red_channel_client_init_send_data(RedChannelClient *rcc, uint16_t msg_type);
uint64_t red_channel_client_get_message_serial(RedChannelClient *channel);
-void red_channel_client_set_message_serial(RedChannelClient *channel, uint64_t);
/* When sending a msg. Should first call red_channel_client_begin_send_message.
* It will first send the pending urgent data, if there is any, and then
commit 10654d34a4ccca7fc10d60c674c975e6455bf78f
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Tue Feb 14 19:32:57 2017 +0000
rcc: Remove unused RedChannelClient::{is_connected,disconnect} vfuncs
RedChannelClient is responsible for talking to the client so it knows
if is connected or not.
These vfuncs where used by DummyChannel used by SoundChannel.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
diff --git a/server/red-channel-client.c b/server/red-channel-client.c
index 32db186..16e5446 100644
--- a/server/red-channel-client.c
+++ b/server/red-channel-client.c
@@ -364,10 +364,6 @@ static void red_channel_client_initable_interface_init(GInitableIface *iface)
iface->init = red_channel_client_initable_init;
}
-static gboolean red_channel_client_default_is_connected(RedChannelClient *rcc);
-static void red_channel_client_default_disconnect(RedChannelClient *rcc);
-
-
static void red_channel_client_constructed(GObject *object)
{
RedChannelClient *self = RED_CHANNEL_CLIENT(object);
@@ -400,9 +396,6 @@ static void red_channel_client_class_init(RedChannelClientClass *klass)
object_class->finalize = red_channel_client_finalize;
object_class->constructed = red_channel_client_constructed;
- klass->is_connected = red_channel_client_default_is_connected;
- klass->disconnect = red_channel_client_default_disconnect;
-
spec = g_param_spec_pointer("stream", "stream",
"Associated RedStream",
G_PARAM_STATIC_STRINGS
@@ -1701,20 +1694,12 @@ gboolean red_channel_client_is_mini_header(RedChannelClient *rcc)
return rcc->priv->is_mini_header;
}
-static gboolean red_channel_client_default_is_connected(RedChannelClient *rcc)
+gboolean red_channel_client_is_connected(RedChannelClient *rcc)
{
return rcc->priv->channel
&& (g_list_find(red_channel_get_clients(rcc->priv->channel), rcc) != NULL);
}
-gboolean red_channel_client_is_connected(RedChannelClient *rcc)
-{
- RedChannelClientClass *klass = RED_CHANNEL_CLIENT_GET_CLASS(rcc);
-
- g_return_val_if_fail(klass->is_connected != NULL, FALSE);
- return klass->is_connected(rcc);
-}
-
static void red_channel_client_clear_sent_item(RedChannelClient *rcc)
{
rcc->priv->send_data.blocked = FALSE;
@@ -1752,7 +1737,7 @@ void red_channel_client_push_set_ack(RedChannelClient *rcc)
red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_TYPE_SET_ACK);
}
-static void red_channel_client_default_disconnect(RedChannelClient *rcc)
+void red_channel_client_disconnect(RedChannelClient *rcc)
{
RedChannel *channel = rcc->priv->channel;
SpiceCoreInterfaceInternal *core = red_channel_get_core_interface(channel);
@@ -1781,14 +1766,6 @@ static void red_channel_client_default_disconnect(RedChannelClient *rcc)
red_channel_on_disconnect(channel, rcc);
}
-void red_channel_client_disconnect(RedChannelClient *rcc)
-{
- RedChannelClientClass *klass = RED_CHANNEL_CLIENT_GET_CLASS(rcc);
-
- g_return_if_fail(klass->is_connected != NULL);
- klass->disconnect(rcc);
-}
-
int red_channel_client_is_blocked(RedChannelClient *rcc)
{
return rcc && rcc->priv->send_data.blocked;
diff --git a/server/red-channel-client.h b/server/red-channel-client.h
index 75d6cc3..1b0b810 100644
--- a/server/red-channel-client.h
+++ b/server/red-channel-client.h
@@ -192,9 +192,6 @@ struct RedChannelClient
struct RedChannelClientClass
{
GObjectClass parent_class;
-
- gboolean (*is_connected)(RedChannelClient *rcc);
- void (*disconnect)(RedChannelClient *rcc);
};
#define SPICE_SERVER_ERROR spice_server_error_quark()
commit fb4fe2d832844d8fc89cb0f3d83d5da058179adb
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Tue Feb 14 19:30:34 2017 +0000
rcc: Use class name in comment
red_channel seems a variable name.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
diff --git a/server/red-channel-client.h b/server/red-channel-client.h
index 4f1d481..75d6cc3 100644
--- a/server/red-channel-client.h
+++ b/server/red-channel-client.h
@@ -205,7 +205,7 @@ typedef enum
SPICE_SERVER_ERROR_FAILED
} SpiceServerError;
-/* Messages handled by red_channel
+/* Messages handled by RedChannel
* SET_ACK - sent to client on channel connection
* Note that the numbers don't have to correspond to spice message types,
* but we keep the 100 first allocated for base channel approach.
More information about the Spice-commits
mailing list