additional check for pqissl::sockfd before using it (patch from Jenster)

This commit is contained in:
csoler 2015-08-15 10:09:16 -04:00
parent 6eccd57353
commit 2e08dde32b

View File

@ -1827,6 +1827,12 @@ bool pqissl::moretoread(uint32_t usec)
}
#endif
if(sockfd == -1)
{
std::cerr << "pqissl::moretoread(): socket is invalid or closed." << std::endl;
return 0 ;
}
fd_set ReadFDs, WriteFDs, ExceptFDs;
FD_ZERO(&ReadFDs);
FD_ZERO(&WriteFDs);
@ -1889,6 +1895,12 @@ bool pqissl::cansend(uint32_t usec)
"pqissl::cansend() polling socket!");
#endif
if(sockfd == -1)
{
std::cerr << "pqissl::moretoread(): socket is invalid or closed." << std::endl;
return 0 ;
}
// Interestingly - This code might be portable....
fd_set ReadFDs, WriteFDs, ExceptFDs;