mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 08:29:26 -05:00
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:
parent
219e94910e
commit
ab2f506117
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user