fixed bug where stream watermark flushing was incorrect due to code in ASSERT() block
parent
e9469280c1
commit
f55d445755
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
void Usage()
|
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;
|
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
|
// Input stream has likely closed, initiate client shutown
|
||||||
// TBD - initiate client shutdown
|
// 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);
|
NormShutdown(normSocket);
|
||||||
}
|
}
|
||||||
inputNeeded = false; // TBD -should we also fclose(inputFile)???
|
inputNeeded = false; // TBD -should we also fclose(inputFile)???
|
||||||
|
|
@ -277,9 +278,10 @@ int main(int argc, char* argv[])
|
||||||
else if (feof(inputFile))
|
else if (feof(inputFile))
|
||||||
{
|
{
|
||||||
// TBD - initiate client shutdown
|
// 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);
|
NormShutdown(normSocket);
|
||||||
}
|
}
|
||||||
inputNeeded = false; // TBD -should we also fclose(inputFile)???
|
inputNeeded = false; // TBD -should we also fclose(inputFile)???
|
||||||
|
|
@ -326,9 +328,12 @@ int main(int argc, char* argv[])
|
||||||
unsigned int addrLen = 16;
|
unsigned int addrLen = 16;
|
||||||
UINT16 remotePort;
|
UINT16 remotePort;
|
||||||
NormGetPeerName(normSocket, remoteAddr, &addrLen, &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;
|
inputNeeded = true;
|
||||||
writeReady = true;
|
writeReady = true;
|
||||||
|
if (trace && (NULL != groupAddrPtr))
|
||||||
|
NormSetMessageTrace(NormGetSocketMulticastSession(normSocket), true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NORM_SOCKET_READ:
|
case NORM_SOCKET_READ:
|
||||||
|
|
@ -366,13 +371,15 @@ int main(int argc, char* argv[])
|
||||||
writeReady = true;
|
writeReady = true;
|
||||||
break;
|
break;
|
||||||
case NORM_SOCKET_CLOSING:
|
case NORM_SOCKET_CLOSING:
|
||||||
fprintf(stderr, "normClient: server CLOSING connection ...\n");
|
fprintf(stderr, "normClient: %sserver CLOSING connection ...\n",
|
||||||
|
(NULL != groupAddrPtr) ? "multicast " : "");
|
||||||
writeReady = false;
|
writeReady = false;
|
||||||
inputNeeded = false;
|
inputNeeded = false;
|
||||||
break;
|
break;
|
||||||
case NORM_SOCKET_CLOSE:
|
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;
|
writeReady = false;
|
||||||
inputNeeded = false;
|
inputNeeded = false;
|
||||||
keepGoing = false;
|
keepGoing = false;
|
||||||
|
|
|
||||||
|
|
@ -1145,11 +1145,7 @@ void NormSession::Serve()
|
||||||
NormBlock* block = nextObj->FindBlock(nextBlockId);
|
NormBlock* block = nextObj->FindBlock(nextBlockId);
|
||||||
if (block)
|
if (block)
|
||||||
{
|
{
|
||||||
#ifdef PROTO_DEBUG
|
|
||||||
ASSERT(block->GetFirstPending(nextSegmentId));
|
|
||||||
#else
|
|
||||||
block->GetFirstPending(nextSegmentId);
|
block->GetFirstPending(nextSegmentId);
|
||||||
#endif // if/else PROTO_DEBUG
|
|
||||||
// Adjust so watermark segmentId < block length
|
// Adjust so watermark segmentId < block length
|
||||||
UINT16 nextBlockSize = nextObj->GetBlockSize(nextBlockId);
|
UINT16 nextBlockSize = nextObj->GetBlockSize(nextBlockId);
|
||||||
if (nextSegmentId >= nextBlockSize) nextSegmentId = nextBlockSize - 1;
|
if (nextSegmentId >= nextBlockSize) nextSegmentId = nextBlockSize - 1;
|
||||||
|
|
@ -2243,7 +2239,10 @@ void NormSession::TxSocketRecvHandler(ProtoSocket& theSocket,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Probably an ICMP "port unreachable" error
|
// 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);
|
Notify(NormController::SEND_ERROR, NULL, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -2361,6 +2360,9 @@ void NormSession::RxSocketRecvHandler(ProtoSocket& theSocket,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Probably an ICMP "port unreachable" error
|
// 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())
|
if (Address().IsUnicast())
|
||||||
Notify(NormController::SEND_ERROR, NULL, NULL);
|
Notify(NormController::SEND_ERROR, NULL, NULL);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue