From 9b8e801777f2bcc15c6ca1caffca3236b8cf2b75 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Sat, 6 May 2017 21:17:28 +0200 Subject: Add more cleanup code on connection loss --- vchat-protocol.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'vchat-protocol.c') diff --git a/vchat-protocol.c b/vchat-protocol.c index 88631ef..f1b71a1 100755 --- a/vchat-protocol.c +++ b/vchat-protocol.c @@ -192,9 +192,12 @@ vcconnect (char *server, char *port) /* disconnect from server */ void vcdisconnect () { - if (server_conn) - BIO_free_all( server_conn ); - serverfd = -1; + BIO_free_all( server_conn ); + server_conn = 0; + if (serverfd>0) { + close(serverfd); + serverfd = -1; + } } /* handle a pm not sent error -- cgit v1.2.3