uint8 inIPollCb;
Bool inRecvLoop;
- Bool inDoOneMsg;
uint32 inBlockingRecv;
struct AsyncTCPSocket *listenAsock4;
return ASOCKERR_NOTCONNECTED;
}
- if (asock->inBlockingRecv) {
+ if (asock->inBlockingRecv && !asock->inRecvLoop) {
TCPSOCKWARN(asock, ("Recv called while a blocking recv is pending.\n"));
return ASOCKERR_INVAL;
}
s->inBlockingRecv++;
retVal = AsyncTCPSocketPoll(s, read, timeoutMS, &asock);
- s->inBlockingRecv--;
if (retVal != ASOCKERR_SUCCESS) {
if (retVal == ASOCKERR_GENERIC) {
TCPSOCKWARN(s, ("%s: failed to poll on the socket during read.\n",
}
} else {
ASSERT(asock == s);
- s->inDoOneMsg = TRUE;
retVal = AsyncTCPSocketFillRecvBuffer(s);
- s->inDoOneMsg = FALSE;
}
+ s->inBlockingRecv--;
/*
* If socket got closed in AsyncTCPSocketFillRecvBuffer, we
asock->internalRecvFn);
/* Callback might be temporarily removed in AsyncSocket_DoOneMsg. */
ASSERT_NOT_TESTED(removed ||
- asock->inDoOneMsg ||
+ asock->inBlockingRecv ||
AsyncTCPSocketPollParams(asock)->iPoll);
asock->recvCb = FALSE;
return ASOCKERR_INVAL;
}
- if (asock->inBlockingRecv) {
+ if (asock->inBlockingRecv && !asock->inRecvLoop) {
Warning(ASOCKPREFIX "Cannot cancel request while a blocking recv is "
"pending.\n");
return ASOCKERR_INVAL;