From 72a3396a5802b34bd675fbb3aa279df80cf34071 Mon Sep 17 00:00:00 2001 From: joss17 Date: Mon, 15 Feb 2010 15:31:37 +0000 Subject: [PATCH] add a control when establishing a ssl connection and the sockfd is -1 git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2331 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/pqi/pqissl.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libretroshare/src/pqi/pqissl.cc b/libretroshare/src/pqi/pqissl.cc index f329b5f01..44a09d0c4 100644 --- a/libretroshare/src/pqi/pqissl.cc +++ b/libretroshare/src/pqi/pqissl.cc @@ -739,7 +739,16 @@ int pqissl::Basic_Connection_Complete() "pqissl::Basic_Connection_Complete() Wrong Mode"); return -1; } - // use select on the opened socket. + + if (sockfd == -1) + { + rslog(RSL_DEBUG_BASIC, pqisslzone, + "pqissl::Basic_Connection_Complete() problem with the socket descriptor. Aborting"); + reset(); + return -1; + } + + // use select on the opened socket. // Interestingly - This code might be portable.... fd_set ReadFDs, WriteFDs, ExceptFDs;