Added extra checks for valid sockfd in cansend / moretoread code

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7950 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2015-02-17 11:57:08 +00:00
parent 219e94910e
commit ab2f506117

View File

@ -552,6 +552,19 @@ bool pqissludp::moretoread(uint32_t usec)
{
RsStackMutex stack(mSslMtx); /**** LOCKED MUTEX ****/
// Extra Checks to avoid crashes in v0.6 ... pqithreadstreamer calls this function
// when sockfd = -1 during the shutdown of the thread.
// NB: it should never reach here if bio->isActive() returns false.
// Some mismatch to chase down when we have a chance.
// SAME test is at cansend.
if (sockfd < 0)
{
std::cerr << "pqissludp::moretoread() INVALID sockfd PARAMETER ... bad shutdown?";
std::cerr << std::endl;
return false;
}
{
std::string out = "pqissludp::moretoread()";
rs_sprintf_append(out, " polling socket (%d)", sockfd);
@ -626,6 +639,18 @@ bool pqissludp::cansend(uint32_t usec)
{
RsStackMutex stack(mSslMtx); /**** LOCKED MUTEX ****/
// Extra Checks to avoid crashes in v0.6 ... pqithreadstreamer calls this function
// when sockfd = -1 during the shutdown of the thread.
// NB: it should never reach here if bio->isActive() returns false.
// Some mismatch to chase down when we have a chance.
// SAME test is at can moretoread.
if (sockfd < 0)
{
std::cerr << "pqissludp::cansend() INVALID sockfd PARAMETER ... bad shutdown?";
std::cerr << std::endl;
return false;
}
if (usec)
{
std::cerr << "pqissludp::cansend() usec parameter: " << usec;