[Spice-commits] 8 commits - gtk/channel-display-priv.h gtk/channel-display.c gtk/channel-main.c gtk/channel-webdav.c gtk/spice-session.c
Christophe Fergau
teuf at kemper.freedesktop.org
Thu Jan 29 08:12:42 PST 2015
gtk/channel-display-priv.h | 2 -
gtk/channel-display.c | 14 +++++------
gtk/channel-main.c | 3 --
gtk/channel-webdav.c | 9 ++++++-
gtk/spice-session.c | 54 +++++++++++++++++++++++++--------------------
5 files changed, 48 insertions(+), 34 deletions(-)
New commits:
commit ab33cf5f81924a78eac5096ac21ebce08aebf8e1
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Thu Jan 29 14:41:31 2015 +0100
Don't set SpiceSession::cmain twice during migration
During migration, migrate_connect() ends with:
spice_session_set_main_channel(mig->session,
migrate_channel_connect(mig, SPICE_CHANNEL_MAIN, 0));
migrate_channel_connect() calls spice_channel_new() which will create a
new SpiceMainChannel instance.
spice_channel_constructed() will be called during this instanciation,
which will call spice_session_channel_new(), which will set
SpiceSession::cmain for SpiceMainChannel instances.
When calling spice_session_set_main_channel(), SpiceSession::cmain will
thus already be set, which causes a runtime warning as
spice_session_set_main_channel() has a precondition checking that
SpiceSession::cmain is not set already.
This commit removes the call to spice_session_set_main_channel() from
migrate_connect() as this call is not doing anything more than the call
to migrate_channel_connect().
diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 7af4a2e..82169aa 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -2132,8 +2132,7 @@ static gboolean migrate_connect(gpointer data)
/* the migration process is in 2 steps, first the main channel and
then the rest of the channels */
- spice_session_set_main_channel(mig->session,
- migrate_channel_connect(mig, SPICE_CHANNEL_MAIN, 0));
+ migrate_channel_connect(mig, SPICE_CHANNEL_MAIN, 0);
return FALSE;
}
commit a75faf17146cb54137270e71d91c96599fba083c
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Thu Jan 29 11:21:29 2015 +0100
Remove runtime warning when setting a NULL shared-dir
Now that the webdav channel can cope with a NULL shared dir (by not
creating the webdav server), we no longer need to reject NULL shared
directories with a warning.
This fixes part of https://bugzilla.redhat.com/show_bug.cgi?id=1175721
diff --git a/gtk/spice-session.c b/gtk/spice-session.c
index 059cd2f..8de48e5 100644
--- a/gtk/spice-session.c
+++ b/gtk/spice-session.c
@@ -2485,7 +2485,6 @@ G_GNUC_INTERNAL
void spice_session_set_shared_dir(SpiceSession *session, const gchar *dir)
{
g_return_if_fail(SPICE_IS_SESSION(session));
- g_return_if_fail(dir != NULL);
SpiceSessionPrivate *s = session->priv;
commit 6163828e8cb15d539c80cc3f0bfb5008be9b2247
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Thu Jan 29 11:04:46 2015 +0100
webdav: Cope with NULL SpiceSession::shared-dir
shared-dir default value is
g_get_user_special_dir(G_USER_DIRECTORY_PUBLIC_SHARE)
which can be NULL (for example if ~/.config/user-dirs.dirs does not
exist).
This commit makes sure we don't create a PhodavServer when this occurs
diff --git a/gtk/channel-webdav.c b/gtk/channel-webdav.c
index 94f3ef3..bce46fa 100644
--- a/gtk/channel-webdav.c
+++ b/gtk/channel-webdav.c
@@ -700,8 +700,15 @@ PhodavServer* channel_webdav_server_new(SpiceSession *session)
PhodavServer *dav;
SoupServer *server;
SoupSocket *listener;
+ const char *shared_dir;
- dav = phodav_server_new(0, spice_session_get_shared_dir(session));
+ shared_dir = spice_session_get_shared_dir(session);
+ if (shared_dir != NULL) {
+ g_debug("No shared dir set, not creating webdav channel");
+ return NULL;
+ }
+
+ dav = phodav_server_new(0, shared_dir);
server = phodav_server_get_soup_server(dav);
listener = soup_server_get_listener(server);
diff --git a/gtk/spice-session.c b/gtk/spice-session.c
index a62d533..059cd2f 100644
--- a/gtk/spice-session.c
+++ b/gtk/spice-session.c
@@ -2626,7 +2626,9 @@ PhodavServer* spice_session_get_webdav_server(SpiceSession *session)
session->priv->webdav_magic[i] = g_random_int_range(0, 255);
session->priv->webdav = channel_webdav_server_new(session);
- phodav_server_run(session->priv->webdav);
+ if (session->priv->webdav != NULL) {
+ phodav_server_run(session->priv->webdav);
+ }
}
g_static_mutex_unlock(&mutex);
#endif
commit d6ec4db29a9da55d39c5cd6c8dc0c81f8050aad0
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Wed Jan 28 17:30:04 2015 +0100
display: Fix 'exisiting' typo in debug log
diff --git a/gtk/channel-display.c b/gtk/channel-display.c
index dcb20e2..efe2259 100644
--- a/gtk/channel-display.c
+++ b/gtk/channel-display.c
@@ -764,7 +764,7 @@ static void clear_surfaces(SpiceChannel *channel, gboolean keep_primary)
while (g_hash_table_iter_next(&iter, NULL, (gpointer*)&surface)) {
if (keep_primary && surface->primary) {
- CHANNEL_DEBUG(channel, "keeping exisiting primary surface, migration or reset");
+ CHANNEL_DEBUG(channel, "keeping existing primary surface, migration or reset");
continue;
}
commit 42e640d00183e499b764e77957be673d675a7454
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Wed Jan 28 11:33:26 2015 +0100
display: s/dropin/dropping in debug message
diff --git a/gtk/channel-display.c b/gtk/channel-display.c
index e588589..dcb20e2 100644
--- a/gtk/channel-display.c
+++ b/gtk/channel-display.c
@@ -1360,7 +1360,7 @@ static void display_handle_stream_data(SpiceChannel *channel, SpiceMsgIn *in)
latency = op->multi_media_time - mmtime;
if (latency < 0) {
- CHANNEL_DEBUG(channel, "stream data too late by %u ms (ts: %u, mmtime: %u), dropin",
+ CHANNEL_DEBUG(channel, "stream data too late by %u ms (ts: %u, mmtime: %u), dropping",
mmtime - op->multi_media_time, op->multi_media_time, mmtime);
st->arrive_late_time += mmtime - op->multi_media_time;
st->num_drops_on_receive++;
commit 315c1a5e668c6e31f69fa37699f9db13326a4e11
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Tue Jan 27 16:58:40 2015 +0100
session: Add more debugging logs
Initial SPICE connection can sometimes fail without clear indications
where/how it failed. This commit adds more debug logs/more accurate logs
in order to help narrow down such issues.
diff --git a/gtk/spice-session.c b/gtk/spice-session.c
index 7f15d98..a62d533 100644
--- a/gtk/spice-session.c
+++ b/gtk/spice-session.c
@@ -1924,10 +1924,12 @@ static void socket_client_connect_ready(GObject *source_object, GAsyncResult *re
spice_open_host *open_host = data;
GSocketConnection *connection = NULL;
- SPICE_DEBUG("connect ready");
+ CHANNEL_DEBUG(open_host->channel, "connect ready");
connection = g_socket_client_connect_finish(client, result, &open_host->error);
- if (connection == NULL)
+ if (connection == NULL) {
+ g_warn_if_fail(open_host->error != NULL);
goto end;
+ }
open_host->connection = connection;
@@ -1938,7 +1940,7 @@ end:
/* main context */
static void open_host_connectable_connect(spice_open_host *open_host, GSocketConnectable *connectable)
{
- SPICE_DEBUG("connecting %p...", open_host);
+ CHANNEL_DEBUG(open_host->channel, "connecting %p...", open_host);
g_socket_client_connect_async(open_host->client, connectable,
open_host->cancellable,
@@ -2065,8 +2067,10 @@ GSocketConnection* spice_session_channel_open_host(SpiceSession *session, SpiceC
}
} else {
port = *use_tls ? s->tls_port : s->port;
- if (port == NULL)
+ if (port == NULL) {
+ g_warning("Missing port value (use_tls: %d)", *use_tls);
return NULL;
+ }
open_host.port = strtol(port, &endptr, 10);
if (*port == '\0' || *endptr != '\0' ||
@@ -2075,6 +2079,11 @@ GSocketConnection* spice_session_channel_open_host(SpiceSession *session, SpiceC
return NULL;
}
}
+ if (*use_tls) {
+ CHANNEL_DEBUG(channel, "Using TLS, port %d", open_host.port);
+ } else {
+ CHANNEL_DEBUG(channel, "Using plain text, port %d", open_host.port);
+ }
open_host.client = g_socket_client_new();
g_socket_client_set_timeout(open_host.client, SOCKET_TIMEOUT);
@@ -2084,7 +2093,7 @@ GSocketConnection* spice_session_channel_open_host(SpiceSession *session, SpiceC
coroutine_yield(NULL);
if (open_host.error != NULL) {
- SPICE_DEBUG("open host: %s", open_host.error->message);
+ CHANNEL_DEBUG(channel, "open host: %s", open_host.error->message);
g_propagate_error(error, open_host.error);
} else if (open_host.connection != NULL) {
GSocket *socket;
commit 10418e6a6bcdcd2cec835f0b09442bcf0db9b338
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Wed Nov 12 12:01:21 2014 +0100
display: Improve DisplayChannel::num_drops_on_arive name
'arive' has a typo, and 'num_drops_on_receive' is clearer.
diff --git a/gtk/channel-display-priv.h b/gtk/channel-display-priv.h
index ab66cca..71f5d17 100644
--- a/gtk/channel-display-priv.h
+++ b/gtk/channel-display-priv.h
@@ -78,7 +78,7 @@ typedef struct display_stream {
/* stats */
uint32_t first_frame_mm_time;
- uint32_t num_drops_on_arive;
+ uint32_t num_drops_on_receive;
uint64_t arrive_late_time;
uint32_t num_drops_on_playback;
uint32_t num_input_frames;
diff --git a/gtk/channel-display.c b/gtk/channel-display.c
index fa7fe3c..e588589 100644
--- a/gtk/channel-display.c
+++ b/gtk/channel-display.c
@@ -1363,7 +1363,7 @@ static void display_handle_stream_data(SpiceChannel *channel, SpiceMsgIn *in)
CHANNEL_DEBUG(channel, "stream data too late by %u ms (ts: %u, mmtime: %u), dropin",
mmtime - op->multi_media_time, op->multi_media_time, mmtime);
st->arrive_late_time += mmtime - op->multi_media_time;
- st->num_drops_on_arive++;
+ st->num_drops_on_receive++;
if (!st->cur_drops_seq_stats.len) {
st->cur_drops_seq_stats.start_mm_time = op->multi_media_time;
@@ -1439,15 +1439,15 @@ static void destroy_stream(SpiceChannel *channel, int id)
if (!st)
return;
- num_out_frames = st->num_input_frames - st->num_drops_on_arive - st->num_drops_on_playback;
+ num_out_frames = st->num_input_frames - st->num_drops_on_receive - st->num_drops_on_playback;
CHANNEL_DEBUG(channel, "%s: id=%d #in-frames=%d out/in=%.2f "
- "#drops-on-arrive=%d avg-late-time(ms)=%.2f "
+ "#drops-on-receive=%d avg-late-time(ms)=%.2f "
"#drops-on-playback=%d", __FUNCTION__,
id,
st->num_input_frames,
num_out_frames / (double)st->num_input_frames,
- st->num_drops_on_arive,
- st->num_drops_on_arive ? st->arrive_late_time / ((double)st->num_drops_on_arive): 0,
+ st->num_drops_on_receive,
+ st->num_drops_on_receive ? st->arrive_late_time / ((double)st->num_drops_on_receive): 0,
st->num_drops_on_playback);
if (st->num_drops_seqs) {
CHANNEL_DEBUG(channel, "%s: #drops-sequences=%u ==>", __FUNCTION__, st->num_drops_seqs);
commit 01c63439cadf7b0d86c74bab8ec52681d45dabb7
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Tue Jan 27 18:26:12 2015 +0100
Use macro to swap data in spice_session_start_migrating()
spice_session_start_migrating() swaps connection details between 2
SpiceSession instances. Instead of doing it manually, use a macro to do
it for us.
diff --git a/gtk/spice-session.c b/gtk/spice-session.c
index 50ad291..7f15d98 100644
--- a/gtk/spice-session.c
+++ b/gtk/spice-session.c
@@ -1559,6 +1559,15 @@ void spice_session_switching_disconnect(SpiceSession *self)
cache_clear_all(self);
}
+#define SWAP_STR(x, y) G_STMT_START { \
+ const gchar *tmp; \
+ const gchar *a = x; \
+ const gchar *b = y; \
+ tmp = a; \
+ a = b; \
+ b = tmp; \
+} G_STMT_END
+
G_GNUC_INTERNAL
void spice_session_start_migrating(SpiceSession *session,
gboolean full_migration)
@@ -1567,7 +1576,6 @@ void spice_session_start_migrating(SpiceSession *session,
SpiceSessionPrivate *s = session->priv;
SpiceSessionPrivate *m;
- gchar *tmp;
g_return_if_fail(s->migration != NULL);
m = s->migration->priv;
@@ -1578,21 +1586,10 @@ void spice_session_start_migrating(SpiceSession *session,
spice_session_set_migration_state(session, SPICE_SESSION_MIGRATION_MIGRATING);
/* swapping connection details happens after MIGRATION_CONNECTING state */
- tmp = s->host;
- s->host = m->host;
- m->host = tmp;
-
- tmp = s->port;
- s->port = m->port;
- m->port = tmp;
-
- tmp = s->tls_port;
- s->tls_port = m->tls_port;
- m->tls_port = tmp;
-
- tmp = s->unix_path;
- s->unix_path = m->unix_path;
- m->unix_path = tmp;
+ SWAP_STR(s->host, m->host);
+ SWAP_STR(s->port, m->port);
+ SWAP_STR(s->tls_port, m->tls_port);
+ SWAP_STR(s->unix_path, m->unix_path);
g_warn_if_fail(ring_get_length(&s->channels) == ring_get_length(&m->channels));
@@ -1600,6 +1597,7 @@ void spice_session_start_migrating(SpiceSession *session,
ring_get_length(&s->channels), ring_get_length(&m->channels));
s->migration_left = spice_session_get_channels(session);
}
+#undef SWAP_STR
G_GNUC_INTERNAL
SpiceChannel* spice_session_lookup_channel(SpiceSession *session, gint id, gint type)
More information about the Spice-commits
mailing list