[client] fix improper spice socket shutdown

This commit is contained in:
Geoffrey McRae
2018-01-29 17:27:12 +11:00
parent dc6932a9ba
commit 78a100135b
3 changed files with 53 additions and 23 deletions

View File

@@ -646,7 +646,17 @@ bool spice_connect_channel(struct SpiceChannel * channel)
void spice_disconnect_channel(struct SpiceChannel * channel)
{
if (channel->connected)
{
shutdown(channel->socket, SHUT_WR);
char buffer[1024];
ssize_t len = 0;
do
len = read(channel->socket, buffer, sizeof(buffer));
while(len > 0);
close(channel->socket);
}
channel->connected = false;
LG_LOCK_FREE(channel->lock);
}