Recently engaged in an Android version of the Spice protocol. After the Andorid-spice official GitHub code is downloaded, the compilation succeeds and runs smoothly on the Android system to link to the cloud desktop, in the case of non-secure ports can be successfully linked to the virtual cloud desktop, But it's very, very annoying, when you link to a TLS port, you always link to a cloud desktop, and the backend reports a bunch of SSL bugs. After repeated search problem, originally this problem is an existing bug, is in the Ssl_read () function execution time due to the system itself for some reason, sometimes the protocol data is read unsuccessful, if at this point let Ssl_read () The function can read the correct business data several times after it waits for the background processing to read the exception. The specific modifications are as follows:
1. Locate the spice-channel.c file.
2. Locate the Spice_channel_read_wire function.
3. The change logic is as follows
static int Spice_channel_read_wire (Spicechannel
channel, voidData, size_t Len)
{
Spicechannelprivate *c = channel->priv;
GSSIZE ret;
Giocondition cond;
int tmp_value_01;
cond = 0;while (1) {
Reread:
if (c->has_error) {
return 0; / Has_error is set by disconnect (), return no error /
}
if (C->TLS) {
ret = Ssl_read (C->SSL, data, Len);
if (Ret < 0) {
ret = Ssl_get_error (C->SSL, ret);
if (ret = = Ssl_error_want_read)
Cond |= g_io_in;
if (ret = = Ssl_error_want_write)
Cond |= G_io_out;
if (ret = = Ssl_error_syscall) {
G_socket_condition_wait (C->sock, G_io_out | G_io_error | G_io_hup, NULL, NULL);
Continue;//goto reread;//
}
ret =-1;
}else{
Mc_debug ("66666666666666666666666666666 ret = =%d::%x", RET,C->SSL);
}
}
if (ret == -1) { if (cond != 0) { g_socket_condition_wait(c->sock, G_IO_OUT | G_IO_ERROR | G_IO_HUP, NULL, NULL); continue;//goto reread;// } else { c->has_error = TRUE; return -errno; } } break;}if (ret == 0) { CHANNEL_DEBUG(channel, "Closing the connection: spice_channel_read() - ret=0"); c->has_error = TRUE; return 0;}//MC_DEBUG("[123456] read_wire: ret = [%d] [%d]", ret, len);return ret;
}
This is a very general pain problem, there is no problem with this ssl_read () in the x86 version of the SPICE-GTK code.
About the Android version Spice Protocol TLS port link way Bug Issue