[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);
}

View File

@@ -22,6 +22,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include <stdint.h>
bool spice_connect(const char * host, const short port, const char * password);
void spice_drain();
void spice_disconnect();
bool spice_process();
bool spice_ready();