summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathon Jongsma <jjongsma@redhat.com>2015-02-06 14:39:39 -0600
committerFabiano FidĂȘncio <fidencio@redhat.com>2015-02-23 23:00:46 +0100
commite49e6e5b8937daf553a615c12925296ef3b68dcb (patch)
tree0b459c415c82101b965ec38345fe8b59705f9902
parentd4837620ab3a4db4b2aef109872cf1817a2ac0dd (diff)
downloadspice-e49e6e5b8937daf553a615c12925296ef3b68dcb.tar.gz
spice-e49e6e5b8937daf553a615c12925296ef3b68dcb.tar.xz
spice-e49e6e5b8937daf553a615c12925296ef3b68dcb.zip
Add red_channel_get_server()
Instead of poking into the internals of the RedChannel, provide an accessor.
-rw-r--r--server/inputs-channel.c4
-rw-r--r--server/main-channel.c2
-rw-r--r--server/red-channel.c5
-rw-r--r--server/red-channel.h1
4 files changed, 9 insertions, 3 deletions
diff --git a/server/inputs-channel.c b/server/inputs-channel.c
index 7de4966e..382b3c57 100644
--- a/server/inputs-channel.c
+++ b/server/inputs-channel.c
@@ -310,7 +310,7 @@ static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui
InputsChannel *inputs_channel = (InputsChannel *)rcc->channel;
InputsChannelClient *icc = (InputsChannelClient *)rcc;
uint32_t i;
- RedsState *reds = inputs_channel->base.reds;
+ RedsState *reds = red_channel_get_server((RedChannel*)inputs_channel);
switch (type) {
case SPICE_MSGC_INPUTS_KEY_DOWN: {
@@ -680,7 +680,7 @@ int inputs_channel_set_keyboard(InputsChannel *inputs, SpiceKbdInstance *keyboar
return -1;
}
inputs->keyboard = keyboard;
- inputs->keyboard->st = spice_kbd_state_new(inputs->base.reds);
+ inputs->keyboard->st = spice_kbd_state_new(red_channel_get_server((RedChannel*)inputs));
return 0;
}
diff --git a/server/main-channel.c b/server/main-channel.c
index 572fcac1..f53946dd 100644
--- a/server/main-channel.c
+++ b/server/main-channel.c
@@ -1113,7 +1113,7 @@ static MainChannelClient *main_channel_client_create(MainChannel *main_chan, Red
mcc->connection_id = connection_id;
mcc->bitrate_per_sec = ~0;
#ifdef RED_STATISTICS
- if (!(mcc->ping_timer = reds_get_core_interface(main_chan->base.reds)->timer_add(ping_timer_cb, NULL))) {
+ if (!(mcc->ping_timer = reds_get_core_interface(red_channel_get_server((RedChannel*)main_chan))->timer_add(ping_timer_cb, NULL))) {
spice_error("ping timer create failed");
}
mcc->ping_interval = PING_INTERVAL;
diff --git a/server/red-channel.c b/server/red-channel.c
index 646b000b..58001ec3 100644
--- a/server/red-channel.c
+++ b/server/red-channel.c
@@ -2459,3 +2459,8 @@ void red_channel_client_disconnect_if_pending_send(RedChannelClient *rcc)
spice_warn_if_fail(red_channel_client_no_item_being_sent(rcc));
}
+
+RedsState* red_channel_get_server(RedChannel *channel)
+{
+ return channel->reds;
+}
diff --git a/server/red-channel.h b/server/red-channel.h
index 681d7e1c..0da742c0 100644
--- a/server/red-channel.h
+++ b/server/red-channel.h
@@ -573,6 +573,7 @@ typedef void (*channel_client_callback)(RedChannelClient *rcc);
typedef void (*channel_client_callback_data)(RedChannelClient *rcc, void *data);
void red_channel_apply_clients(RedChannel *channel, channel_client_callback v);
void red_channel_apply_clients_data(RedChannel *channel, channel_client_callback_data v, void *data);
+RedsState* red_channel_get_server(RedChannel *channel);
struct RedClient {
RedsState *reds;