diff options
author | Christophe Fergeau <cfergeau@redhat.com> | 2013-10-10 16:28:04 +0200 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2013-10-10 18:02:35 +0200 |
commit | e8393910e9aaf2610e1a587f41e8b17229cb71bd (patch) | |
tree | 46c77dcec61b7a8f77fe783b1570bd7401134333 /gtk | |
parent | 02aaa8678f311602793ede0f4e081fbd9cf28acd (diff) |
Reenable call to switch_protocol() on protocol version mismatches
This partially reverts b19acbc. This commit broke the fallback
to the old protocol as it added a check for c->peer_msg != NULL
before calling switch_protocol(), but mismatch between local
and remote protocol versions is detected before c->peer_msg is
allocated, so:
if (c->peer_msg != NULL && c->link_hdr.major_version != 1) {
SPICE_DEBUG("%s: error, switching to protocol 1 (spice 0.4)",
c->name);
spice_channel_switch_protocol(channel, 1);
return TRUE;
}
will never get triggered when c->peer_hdr.major_version !=
c->link_hdr.major_version
The crash described in b19acbc occurred when calling
spice_channel_recv_link_msg() in spice_channel_coroutine()
after a call to spice_channel_recv_link_hdr() failed and did
not set c->peer_msg.
This commit removes the c>peer_msg check done before calling
spice_channel_switch_protocol() so that it gets called when needed,
but makes sure that we return FALSE to indicate that an error happened
and that we need to reconnect. This way we won't try to call
spice_channel_recv_link_msg() when c->peer_msg is NULL.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/spice-channel.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c index 150636e..709d7e0 100644 --- a/gtk/spice-channel.c +++ b/gtk/spice-channel.c @@ -1214,10 +1214,10 @@ error: /* Windows socket seems to give early CONNRESET errors. The server does not linger when closing the socket if the protocol is incompatible. Try with the oldest protocol in this case: */ - if (c->peer_msg != NULL && c->link_hdr.major_version != 1) { + if (c->link_hdr.major_version != 1) { SPICE_DEBUG("%s: error, switching to protocol 1 (spice 0.4)", c->name); spice_channel_switch_protocol(channel, 1); - return TRUE; + return FALSE; } emit_main_context(channel, SPICE_CHANNEL_EVENT, SPICE_CHANNEL_ERROR_LINK); |