fixed bug where stream watermark flushing was incorrect due to code in ASSERT() block

pull/9/head
bebopagogo 2020-03-01 14:53:41 -05:00
parent e9469280c1
commit f55d445755
2 changed files with 22 additions and 13 deletions

View File

@ -27,7 +27,7 @@
void Usage()
{
fprintf(stderr, "Usage: normClient [connect <serverAddr>[/<port>][,<groupAddr>]][debug <level>][trace]\n");
fprintf(stderr, "Usage: normClient [connect <serverAddr>/<port>[,<groupAddr>]][debug <level>][trace]\n");
}
const unsigned int MSG_LENGTH_MAX = 64;
@ -257,9 +257,10 @@ int main(int argc, char* argv[])
{
// Input stream has likely closed, initiate client shutown
// TBD - initiate client shutdown
if (NULL == groupAddrPtr)
//if (NULL == groupAddrPtr)
{
fprintf(stderr, "normClient: CLOSING connection to server ...\n");
fprintf(stderr, "normClient: CLOSING connection to %sserver ...\n",
(NULL != groupAddrPtr) ? : "multicast " : "");
NormShutdown(normSocket);
}
inputNeeded = false; // TBD -should we also fclose(inputFile)???
@ -277,9 +278,10 @@ int main(int argc, char* argv[])
else if (feof(inputFile))
{
// TBD - initiate client shutdown
if (NULL == groupAddrPtr)
//if (NULL == groupAddrPtr)
{
fprintf(stderr, "normClient: CLOSING connection to server ...\n");
fprintf(stderr, "normClient: CLOSING connection to %sserver ...\n",
(NULL != groupAddrPtr) ? "multicast " : "");
NormShutdown(normSocket);
}
inputNeeded = false; // TBD -should we also fclose(inputFile)???
@ -326,9 +328,12 @@ int main(int argc, char* argv[])
unsigned int addrLen = 16;
UINT16 remotePort;
NormGetPeerName(normSocket, remoteAddr, &addrLen, &remotePort);
fprintf(stderr, "normClient: CONNECTED to server %s/%hu\n", serverAddr, remotePort);
fprintf(stderr, "normClient: CONNECTED to %sserver %s/%hu\n",
(NULL != groupAddrPtr) ? "multicast " : "", serverAddr, remotePort);
inputNeeded = true;
writeReady = true;
if (trace && (NULL != groupAddrPtr))
NormSetMessageTrace(NormGetSocketMulticastSession(normSocket), true);
break;
}
case NORM_SOCKET_READ:
@ -366,13 +371,15 @@ int main(int argc, char* argv[])
writeReady = true;
break;
case NORM_SOCKET_CLOSING:
fprintf(stderr, "normClient: server CLOSING connection ...\n");
fprintf(stderr, "normClient: %sserver CLOSING connection ...\n",
(NULL != groupAddrPtr) ? "multicast " : "");
writeReady = false;
inputNeeded = false;
break;
case NORM_SOCKET_CLOSE:
{
fprintf(stderr, "normClient: connection to server CLOSED.\n");
fprintf(stderr, "normClient: connection to %sserver CLOSED.\n",
(NULL != groupAddrPtr) ? "multicast " : "");
writeReady = false;
inputNeeded = false;
keepGoing = false;

View File

@ -1145,11 +1145,7 @@ void NormSession::Serve()
NormBlock* block = nextObj->FindBlock(nextBlockId);
if (block)
{
#ifdef PROTO_DEBUG
ASSERT(block->GetFirstPending(nextSegmentId));
#else
block->GetFirstPending(nextSegmentId);
#endif // if/else PROTO_DEBUG
// Adjust so watermark segmentId < block length
UINT16 nextBlockSize = nextObj->GetBlockSize(nextBlockId);
if (nextSegmentId >= nextBlockSize) nextSegmentId = nextBlockSize - 1;
@ -2243,7 +2239,10 @@ void NormSession::TxSocketRecvHandler(ProtoSocket& theSocket,
else
{
// Probably an ICMP "port unreachable" error
if (Address().IsUnicast())
// Note we purposefull do _not_ set the "posted_send_error"
// status here because we do not want this notification
// cleared due to SEND_OK status since it's receiver driven
if (Address().IsUnicast())
Notify(NormController::SEND_ERROR, NULL, NULL);
break;
}
@ -2361,6 +2360,9 @@ void NormSession::RxSocketRecvHandler(ProtoSocket& theSocket,
else
{
// Probably an ICMP "port unreachable" error
// Note we purposefull do _not_ set the "posted_send_error"
// status here because we do not want this notification
// cleared due to SEND_OK status since it's receiver driven
if (Address().IsUnicast())
Notify(NormController::SEND_ERROR, NULL, NULL);
break;