[Spice-commits] 5 commits - server/glz_encoder_dictionary.c server/glz_encoder_dictionary_protected.h server/inputs_channel.c server/red_channel.c server/red_tunnel_worker.c server/red_worker.c
Alon Levy
alon at kemper.freedesktop.org
Thu Aug 30 09:34:39 PDT 2012
server/glz_encoder_dictionary.c | 12 ++++++------
server/glz_encoder_dictionary_protected.h | 2 +-
server/inputs_channel.c | 2 +-
server/red_channel.c | 1 +
server/red_tunnel_worker.c | 6 ------
server/red_worker.c | 13 +++++++------
6 files changed, 16 insertions(+), 20 deletions(-)
New commits:
commit 897aaa7be51ab0b44436340cf6beedae03544199
Author: Alon Levy <alevy at redhat.com>
Date: Thu Aug 30 14:33:04 2012 +0300
server/red_worker: seamless: fix invalid memory reference
replace add_ref with add for stack allocated SpiceMigrateDataDisplay.
This fixes wrong MIGRATE_DATA message in display channel (symptom is
glz_encoder_max being way too big, and malloc failure at target) seen on
F18 with gcc-4.7.1-5.fc18.x86_64 and glibc-2.16-8.fc18.x86_64 (didn't
appear on RHEL 6).
diff --git a/server/red_worker.c b/server/red_worker.c
index 6113727..44ffc33 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -8442,7 +8442,7 @@ static void display_channel_marshall_migrate_data(RedChannelClient *rcc,
{
DisplayChannel *display_channel;
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
- SpiceMigrateDataDisplay display_data;
+ SpiceMigrateDataDisplay display_data = {0,};
display_channel = SPICE_CONTAINEROF(rcc->channel, DisplayChannel, common.base);
@@ -8471,8 +8471,8 @@ static void display_channel_marshall_migrate_data(RedChannelClient *rcc,
&dcc->glz_data.usr);
/* all data besided the surfaces ref */
- spice_marshaller_add_ref(base_marshaller,
- (uint8_t *)&display_data, sizeof(display_data) - sizeof(uint32_t));
+ spice_marshaller_add(base_marshaller,
+ (uint8_t *)&display_data, sizeof(display_data) - sizeof(uint32_t));
display_channel_marshall_migrate_data_surfaces(dcc, base_marshaller,
display_channel->enable_jpeg);
}
commit 3d28317e978271085ad274139f5646b2b171d509
Author: Alon Levy <alevy at redhat.com>
Date: Thu Aug 30 10:36:54 2012 +0300
server: freezed->froze, missing whitespace after declarations
diff --git a/server/red_channel.c b/server/red_channel.c
index c720b70..b52f9e6 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -734,6 +734,7 @@ int red_channel_client_waits_for_migrate_data(RedChannelClient *rcc)
int red_channel_waits_for_migrate_data(RedChannel *channel)
{
RedChannelClient *rcc;
+
if (!red_channel_is_connected(channel)) {
return FALSE;
}
diff --git a/server/red_worker.c b/server/red_worker.c
index 2fa0e3a..6113727 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -9828,9 +9828,9 @@ static int display_channel_handle_migrate_data(RedChannelClient *rcc, uint32_t s
spice_error("bad header");
return FALSE;
}
- /* size is set to -1 in order to keep the cache freezed till the original
- * channel client that freezed the cache on the src size receive the migrate
- * data and unfreeze the cache by setting its size > 0 and by triggering
+ /* size is set to -1 in order to keep the cache frozen until the original
+ * channel client that froze the cache on the src size receives the migrate
+ * data and unfreezes the cache by setting its size > 0 and by triggering
* pixmap_cache_reset */
dcc->pixmap_cache = red_get_pixmap_cache(dcc->common.base.client,
migrate_data->pixmap_cache_id, -1);
@@ -9890,6 +9890,7 @@ static int display_channel_handle_message(RedChannelClient *rcc, uint32_t size,
void *message)
{
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
+
switch (type) {
case SPICE_MSGC_DISPLAY_INIT:
if (!dcc->expect_init) {
commit 4f7876e4c86b284db33c50888b759fbd71a630b1
Author: Alon Levy <alevy at redhat.com>
Date: Thu Aug 30 10:35:47 2012 +0300
server: s/max_encdoers/max_encoders/
diff --git a/server/glz_encoder_dictionary.c b/server/glz_encoder_dictionary.c
index efe6cb8..df346d0 100644
--- a/server/glz_encoder_dictionary.c
+++ b/server/glz_encoder_dictionary.c
@@ -62,7 +62,7 @@ static int glz_dictionary_window_create(SharedDictionary *dict, uint32_t size)
dict->window.segs_quota = INIT_IMAGE_SEGS_NUM;
dict->window.encoders_heads = (uint32_t *)dict->cur_usr->malloc(dict->cur_usr,
- sizeof(uint32_t) * dict->max_encdoers);
+ sizeof(uint32_t) * dict->max_encoders);
if (!dict->window.encoders_heads) {
dict->cur_usr->free(dict->cur_usr, dict->window.segs);
@@ -101,7 +101,7 @@ static void glz_dictionary_window_reset(SharedDictionary *dict)
dict->window.used_segs_tail = NULL_IMAGE_SEG_ID;
// reset encoders heads
- for (i = 0; i < dict->max_encdoers; i++) {
+ for (i = 0; i < dict->max_encoders; i++) {
dict->window.encoders_heads[i] = NULL_IMAGE_SEG_ID;
}
@@ -156,7 +156,7 @@ GlzEncDictContext *glz_enc_dictionary_create(uint32_t size, uint32_t max_encoder
dict->cur_usr = usr;
dict->last_image_id = 0;
- dict->max_encdoers = max_encoders;
+ dict->max_encoders = max_encoders;
pthread_mutex_init(&dict->lock, NULL);
pthread_rwlock_init(&dict->rw_alloc_lock, NULL);
@@ -184,7 +184,7 @@ void glz_enc_dictionary_get_restore_data(GlzEncDictContext *opaque_dict,
GLZ_ASSERT(dict->cur_usr, out_data);
out_data->last_image_id = dict->last_image_id;
- out_data->max_encoders = dict->max_encdoers;
+ out_data->max_encoders = dict->max_encoders;
out_data->size = dict->window.size_limit;
}
@@ -426,7 +426,7 @@ static WindowImage *glz_dictionary_window_get_new_head(SharedDictionary *dict, i
static INLINE int glz_dictionary_is_in_use(SharedDictionary *dict)
{
uint32_t i = 0;
- for (i = 0; i < dict->max_encdoers; i++) {
+ for (i = 0; i < dict->max_encoders; i++) {
if (dict->window.encoders_heads[i] != NULL_IMAGE_SEG_ID) {
return TRUE;
}
@@ -603,7 +603,7 @@ void glz_dictionary_post_encode(uint32_t encoder_id, GlzEncoderUsrContext *usr,
GLZ_ASSERT(dict->cur_usr, dict->window.encoders_heads[encoder_id] != NULL_IMAGE_SEG_ID);
// get the earliest head in use (not including this encoder head)
- for (i = 0; i < dict->max_encdoers; i++) {
+ for (i = 0; i < dict->max_encoders; i++) {
if (i != encoder_id) {
if (IMAGE_SEG_IS_EARLIER(dict, dict->window.encoders_heads[i], early_head_seg)) {
early_head_seg = dict->window.encoders_heads[i];
diff --git a/server/glz_encoder_dictionary_protected.h b/server/glz_encoder_dictionary_protected.h
index ae7fdc2..ee1f8d8 100644
--- a/server/glz_encoder_dictionary_protected.h
+++ b/server/glz_encoder_dictionary_protected.h
@@ -119,7 +119,7 @@ struct SharedDictionary {
#endif
uint64_t last_image_id;
- uint32_t max_encdoers;
+ uint32_t max_encoders;
pthread_mutex_t lock;
pthread_rwlock_t rw_alloc_lock;
GlzEncoderUsrContext *cur_usr; // each encoder has other context.
commit 1dbe5af2ac25b32578a17a33bf142b173afd72e6
Author: Yonit Halperin <yhalperi at redhat.com>
Date: Wed Aug 29 13:03:27 2012 +0300
server/inputs_channel.c: whitespace fix
diff --git a/server/inputs_channel.c b/server/inputs_channel.c
index ada5a42..bf5c22e 100644
--- a/server/inputs_channel.c
+++ b/server/inputs_channel.c
@@ -541,7 +541,7 @@ static void inputs_migrate(RedChannelClient *rcc)
static void inputs_push_keyboard_modifiers(uint8_t modifiers)
{
- if (!g_inputs_channel || !red_channel_is_connected(&g_inputs_channel->base)||
+ if (!g_inputs_channel || !red_channel_is_connected(&g_inputs_channel->base) ||
g_inputs_channel->src_during_migrate) {
return;
}
commit e9557228d88f7dbf08fd06308a478febeae98b6d
Author: Alon Levy <alevy at redhat.com>
Date: Wed Aug 29 13:02:19 2012 +0300
server/red_tunnel_worker: remove unneeded expect_migrate_mark
diff --git a/server/red_tunnel_worker.c b/server/red_tunnel_worker.c
index 60d6854..97dcafd 100644
--- a/server/red_tunnel_worker.c
+++ b/server/red_tunnel_worker.c
@@ -488,7 +488,6 @@ struct TunnelChannelClient {
RedChannelClient base;
TunnelWorker *worker;
int mig_inprogress;
- int expect_migrate_mark;
int tunnel_error;
@@ -1753,11 +1752,6 @@ static int tunnel_channel_handle_migrate_mark(RedChannelClient *base)
int num_sockets_saved = 0;
RedSocket *sckt;
- if (!channel->expect_migrate_mark) {
- spice_printerr("unexpected");
- return FALSE;
- }
- channel->expect_migrate_mark = FALSE;
migrate_item = spice_new0(TunnelMigrateItem, 1);
migrate_item->base.type = PIPE_ITEM_TYPE_MIGRATE_DATA;
More information about the Spice-commits
mailing list