v1.2b7
parent
05d1cba476
commit
cd02273e2a
17
VERSION.TXT
17
VERSION.TXT
|
|
@ -1,5 +1,22 @@
|
||||||
NORM Version History
|
NORM Version History
|
||||||
|
|
||||||
|
Version 1.2b7
|
||||||
|
=============
|
||||||
|
- Changed normMessage.[h|cpp] to fix alignment issues
|
||||||
|
(and other alignment stuff)
|
||||||
|
- Fixed bug in NormCmdCCMsg::Iterator::GetNextNode()
|
||||||
|
(might significantly help CC performance
|
||||||
|
- Fixed NormServerNode::FreeBuffers() bug which
|
||||||
|
could result in seg fault on remote server timeout
|
||||||
|
or at app shutdown\
|
||||||
|
- Fixed bug where tx_sequence count was being
|
||||||
|
incremented for all transmitted messages (The "fix"
|
||||||
|
does not yet address separate increment of messages
|
||||||
|
sent to different addresses, etc). The bug impacted
|
||||||
|
congestion control performance when nodes acted as
|
||||||
|
sender _and_ receiver (caused receives to overestimate
|
||||||
|
packet loss)
|
||||||
|
|
||||||
Version 1.2b6
|
Version 1.2b6
|
||||||
=============
|
=============
|
||||||
- Added normApi.cpp into libNorm.a (Norm.lib (WIN32)) builds
|
- Added normApi.cpp into libNorm.a (Norm.lib (WIN32)) builds
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,9 @@ class NormInstance : public NormController
|
||||||
static NormInstance* GetInstanceFromSession(NormSessionHandle sessionHandle)
|
static NormInstance* GetInstanceFromSession(NormSessionHandle sessionHandle)
|
||||||
{
|
{
|
||||||
NormSession* session = (NormSession*)sessionHandle;
|
NormSession* session = (NormSession*)sessionHandle;
|
||||||
return static_cast<NormInstance*>(session->GetSessionMgr().GetController());
|
NormInstance* theInstance = static_cast<NormInstance*>(session->GetSessionMgr().GetController());
|
||||||
|
return theInstance;
|
||||||
|
//return static_cast<NormInstance*>(session->GetSessionMgr().GetController());
|
||||||
}
|
}
|
||||||
static NormInstance* GetInstanceFromNode(NormNodeHandle nodeHandle)
|
static NormInstance* GetInstanceFromNode(NormNodeHandle nodeHandle)
|
||||||
{
|
{
|
||||||
|
|
@ -263,7 +265,7 @@ void NormInstance::Notify(NormController::Event event,
|
||||||
DMSG(0, "NormInstance::Notify(RX_OBJECT_NEW) Warning: mkstemp() error: %s\n",
|
DMSG(0, "NormInstance::Notify(RX_OBJECT_NEW) Warning: mkstemp() error: %s\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
}
|
}
|
||||||
if (!((NormFileObject*)object)->Accept(fileName))
|
if (!static_cast<NormFileObject*>(object)->Accept(fileName))
|
||||||
{
|
{
|
||||||
DMSG(0, "NormInstance::Notify(RX_OBJECT_NEW) file object accept error!\n");
|
DMSG(0, "NormInstance::Notify(RX_OBJECT_NEW) file object accept error!\n");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -921,7 +921,8 @@ void NormApp::OnInputReady()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
input_msg_length = ntohs(*((UINT16*)input_buffer));
|
memcpy(&input_msg_length, input_buffer, 2);
|
||||||
|
input_msg_length = ntohs(input_msg_length);
|
||||||
ASSERT(input_msg_length >= 2);
|
ASSERT(input_msg_length >= 2);
|
||||||
UINT16 bufferSpace = 1024 - input_index;
|
UINT16 bufferSpace = 1024 - input_index;
|
||||||
UINT16 msgRemainder = input_msg_length - 2;
|
UINT16 msgRemainder = input_msg_length - 2;
|
||||||
|
|
@ -1136,7 +1137,7 @@ void NormApp::Notify(NormController::Event event,
|
||||||
DMSG(0, "NormApp::Notify(RX_OBJECT_NEW) Warning: mkstemp() error: %s\n",
|
DMSG(0, "NormApp::Notify(RX_OBJECT_NEW) Warning: mkstemp() error: %s\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
}
|
}
|
||||||
if (!((NormFileObject*)object)->Accept(fileName))
|
if (!static_cast<NormFileObject*>(object)->Accept(fileName))
|
||||||
{
|
{
|
||||||
DMSG(0, "NormApp::Notify(RX_OBJECT_NEW) file object accept error!\n");
|
DMSG(0, "NormApp::Notify(RX_OBJECT_NEW) file object accept error!\n");
|
||||||
}
|
}
|
||||||
|
|
@ -1184,7 +1185,7 @@ void NormApp::Notify(NormController::Event event,
|
||||||
// (TBD) and implement overwrite policy
|
// (TBD) and implement overwrite policy
|
||||||
// and cache files in cache mode
|
// and cache files in cache mode
|
||||||
|
|
||||||
if (!((NormFileObject*)object)->Rename(fileName))
|
if (!(static_cast<NormFileObject*>(object)->Rename(fileName)))
|
||||||
{
|
{
|
||||||
DMSG(0, "NormApp::Notify() Error renaming rx file: %s\n",
|
DMSG(0, "NormApp::Notify() Error renaming rx file: %s\n",
|
||||||
fileName);
|
fileName);
|
||||||
|
|
@ -1234,7 +1235,8 @@ void NormApp::Notify(NormController::Event event,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
output_msg_length = ntohs(*((UINT16*)output_buffer));
|
memcpy(&output_msg_length, output_buffer, 2);
|
||||||
|
output_msg_length = ntohs(output_msg_length);
|
||||||
ASSERT(output_msg_length >= 2);
|
ASSERT(output_msg_length >= 2);
|
||||||
readLength = output_msg_length - output_index;
|
readLength = output_msg_length - output_index;
|
||||||
}
|
}
|
||||||
|
|
@ -1340,7 +1342,7 @@ void NormApp::Notify(NormController::Event event,
|
||||||
{
|
{
|
||||||
case NormObject::FILE:
|
case NormObject::FILE:
|
||||||
{
|
{
|
||||||
const char* filePath = ((NormFileObject*)object)->GetPath();
|
const char* filePath = static_cast<NormFileObject*>(object)->GetPath();
|
||||||
//DMSG(0, "norm: Completed rx file: %s\n", filePath);
|
//DMSG(0, "norm: Completed rx file: %s\n", filePath);
|
||||||
if (post_processor->IsEnabled())
|
if (post_processor->IsEnabled())
|
||||||
{
|
{
|
||||||
|
|
@ -1366,6 +1368,7 @@ void NormApp::Notify(NormController::Event event,
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
DMSG(4, "NormApp::Notify() unhandled event: %d\n", event);
|
DMSG(4, "NormApp::Notify() unhandled event: %d\n", event);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} // end switch(event)
|
} // end switch(event)
|
||||||
} // end NormApp::Notify()
|
} // end NormApp::Notify()
|
||||||
|
|
|
||||||
|
|
@ -21,40 +21,35 @@ bool NormMsg::InitFromBuffer(UINT16 msgLength)
|
||||||
// "header_length_base" is type dependent
|
// "header_length_base" is type dependent
|
||||||
switch (GetType())
|
switch (GetType())
|
||||||
{
|
{
|
||||||
|
|
||||||
// for INFO, DATA, and
|
// for INFO, DATA, and
|
||||||
case INFO:
|
case INFO:
|
||||||
header_length_base = 16;
|
header_length_base = 16;
|
||||||
break;
|
break;
|
||||||
case DATA:
|
case DATA:
|
||||||
// (TBD) look at "fec_id" to determine "fec_payload_id" size
|
if (((UINT8*)buffer)[NormObjectMsg::FEC_ID_OFFSET] == 129)
|
||||||
// (we _assume_ "fec_id" == 129 here
|
|
||||||
if ((unsigned char)buffer[NormObjectMsg::FEC_ID_OFFSET] == 129)
|
|
||||||
{
|
{
|
||||||
header_length_base = 24;
|
header_length_base = 24;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DMSG(0, "NormMsg::InitFromBuffer(DATA) unknown fec_id value: %u\n",
|
DMSG(0, "NormMsg::InitFromBuffer(DATA) unknown fec_id value: %u\n",
|
||||||
buffer[NormObjectMsg::FEC_ID_OFFSET]);
|
((UINT8*)buffer)[NormObjectMsg::FEC_ID_OFFSET]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CMD:
|
case CMD:
|
||||||
switch (buffer[NormCmdMsg::FLAVOR_OFFSET])
|
switch (((UINT8*)buffer)[NormCmdMsg::FLAVOR_OFFSET])
|
||||||
{
|
{
|
||||||
case NormCmdMsg::FLUSH:
|
case NormCmdMsg::FLUSH:
|
||||||
case NormCmdMsg::SQUELCH:
|
case NormCmdMsg::SQUELCH:
|
||||||
// (TBD) look at "fec_id" to determine "fec_payload_id" size
|
if (((UINT8*)buffer)[NormCmdFlushMsg::FEC_ID_OFFSET] == 129)
|
||||||
// (we _assume_ "fec_id" == 129 here
|
|
||||||
if ((unsigned char)buffer[NormCmdFlushMsg::FEC_ID_OFFSET] == 129)
|
|
||||||
{
|
{
|
||||||
header_length_base = 24;
|
header_length_base = 24;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DMSG(0, "NormMsg::InitFromBuffer(FLUSH|SQUELCH) unknown fec_id value: %u\n",
|
DMSG(0, "NormMsg::InitFromBuffer(FLUSH|SQUELCH) unknown fec_id value: %u\n",
|
||||||
buffer[NormCmdFlushMsg::FEC_ID_OFFSET]);
|
((UINT8*)buffer)[NormCmdFlushMsg::FEC_ID_OFFSET]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -67,6 +62,11 @@ bool NormMsg::InitFromBuffer(UINT16 msgLength)
|
||||||
case NormCmdMsg::CC:
|
case NormCmdMsg::CC:
|
||||||
header_length_base = 24;
|
header_length_base = 24;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
DMSG(0, "NormMsg::InitFromBuffer() recv'd unkown cmd flavor:%d\n",
|
||||||
|
((UINT8*)buffer)[NormCmdMsg::FLAVOR_OFFSET]);
|
||||||
|
ASSERT(0);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NACK:
|
case NACK:
|
||||||
|
|
@ -91,20 +91,20 @@ bool NormCmdCCMsg::GetCCNode(NormNodeId nodeId,
|
||||||
UINT8& rtt,
|
UINT8& rtt,
|
||||||
UINT16& rate) const
|
UINT16& rate) const
|
||||||
{
|
{
|
||||||
UINT16 cmdLength = length;
|
UINT16 cmdLength = length/4;
|
||||||
UINT16 offset = header_length;
|
UINT16 offset = header_length/4;
|
||||||
nodeId = htonl(nodeId);
|
nodeId = htonl(nodeId);
|
||||||
while (offset < cmdLength)
|
while (offset < cmdLength)
|
||||||
{
|
{
|
||||||
if (nodeId == *((UINT32*)(buffer+offset)))
|
if (nodeId == buffer[offset])
|
||||||
{
|
{
|
||||||
const char* ptr = buffer+offset;
|
const UINT32* ptr = buffer+offset;
|
||||||
flags = ptr[CC_FLAGS_OFFSET];
|
flags = ((UINT8*)ptr)[CC_FLAGS_OFFSET];
|
||||||
rtt = ptr[CC_RTT_OFFSET];
|
rtt = ((UINT8*)ptr)[CC_RTT_OFFSET];
|
||||||
rate = ntohs(*((UINT16*)(ptr+CC_RATE_OFFSET)));
|
rate = ntohs(((UINT16*)ptr)[CC_RATE_OFFSET]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
offset += CC_ITEM_SIZE;
|
offset += CC_ITEM_SIZE/4;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} // end NormCmdCCMsg::GetCCNode()
|
} // end NormCmdCCMsg::GetCCNode()
|
||||||
|
|
@ -121,11 +121,11 @@ bool NormCmdCCMsg::Iterator::GetNextNode(NormNodeId& nodeId,
|
||||||
UINT16& rate)
|
UINT16& rate)
|
||||||
{
|
{
|
||||||
if ((offset+CC_ITEM_SIZE) > cc_cmd.GetLength()) return false;
|
if ((offset+CC_ITEM_SIZE) > cc_cmd.GetLength()) return false;
|
||||||
const char* ptr = cc_cmd.buffer + cc_cmd.header_length;
|
const UINT32* ptr = cc_cmd.buffer + cc_cmd.header_length/4;
|
||||||
nodeId = ntohl(*((UINT32*)(ptr+offset)));
|
nodeId = ntohl(ptr[offset/4]);
|
||||||
flags = ptr[offset+CC_FLAGS_OFFSET];
|
flags = ((UINT8*)ptr)[offset+CC_FLAGS_OFFSET];
|
||||||
rtt = ptr[offset+CC_RTT_OFFSET];
|
rtt = ((UINT8*)ptr)[offset+CC_RTT_OFFSET];
|
||||||
rate = ntohs(*((UINT16*)(ptr+CC_RATE_OFFSET)));
|
rate = ntohs(((UINT16*)ptr)[(offset/2)+CC_RATE_OFFSET]);
|
||||||
offset += CC_ITEM_SIZE;
|
offset += CC_ITEM_SIZE;
|
||||||
return true;
|
return true;
|
||||||
} // end NormCmdCCMsg::Iterator::GetNextNode()
|
} // end NormCmdCCMsg::Iterator::GetNextNode()
|
||||||
|
|
@ -149,13 +149,13 @@ bool NormRepairRequest::AppendRepairItem(const NormObjectId& objectId,
|
||||||
(UINT16)objectId, (UINT32)blockId, (UINT32)symbolId);
|
(UINT16)objectId, (UINT32)blockId, (UINT32)symbolId);
|
||||||
if (buffer_len >= (length+ITEM_LIST_OFFSET+RepairItemLength()))
|
if (buffer_len >= (length+ITEM_LIST_OFFSET+RepairItemLength()))
|
||||||
{
|
{
|
||||||
char* ptr = buffer + length + ITEM_LIST_OFFSET;
|
UINT32* ptr = buffer + (length + ITEM_LIST_OFFSET)/4;
|
||||||
ptr[FEC_ID_OFFSET] = (char)129;
|
((UINT8*)ptr)[FEC_ID_OFFSET] = (char)129;
|
||||||
ptr[RESERVED_OFFSET] = 0;
|
((UINT8*)ptr)[RESERVED_OFFSET] = 0;
|
||||||
*((UINT16*)(ptr+OBJ_ID_OFFSET)) = htons((UINT16)objectId);
|
((UINT16*)ptr)[OBJ_ID_OFFSET] = htons((UINT16)objectId);
|
||||||
*((UINT32*)(ptr+BLOCK_ID_OFFSET)) = htonl((UINT32)blockId);
|
ptr[BLOCK_ID_OFFSET] = htonl((UINT32)blockId);
|
||||||
*((UINT16*)(ptr+BLOCK_LEN_OFFSET)) = htons((UINT16)blockLen);
|
((UINT16*)ptr)[BLOCK_LEN_OFFSET] = htons((UINT16)blockLen);
|
||||||
*((UINT16*)(ptr+SYMBOL_ID_OFFSET)) = htons((UINT16)symbolId);
|
((UINT16*)ptr)[SYMBOL_ID_OFFSET] = htons((UINT16)symbolId);
|
||||||
length += RepairItemLength();
|
length += RepairItemLength();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -180,21 +180,21 @@ bool NormRepairRequest::AppendRepairRange(const NormObjectId& startObjectId,
|
||||||
if (buffer_len >= (length+ITEM_LIST_OFFSET+RepairRangeLength()))
|
if (buffer_len >= (length+ITEM_LIST_OFFSET+RepairRangeLength()))
|
||||||
{
|
{
|
||||||
// range start
|
// range start
|
||||||
char* ptr = buffer + length + ITEM_LIST_OFFSET;
|
UINT32* ptr = buffer + (length + ITEM_LIST_OFFSET)/4;
|
||||||
ptr[FEC_ID_OFFSET] = (char)129;
|
((UINT8*)ptr)[FEC_ID_OFFSET] = (char)129;
|
||||||
ptr[RESERVED_OFFSET] = 0;
|
((UINT8*)ptr)[RESERVED_OFFSET] = 0;
|
||||||
*((UINT16*)(ptr+OBJ_ID_OFFSET)) = htons((UINT16)startObjectId);
|
((UINT16*)ptr)[OBJ_ID_OFFSET] = htons((UINT16)startObjectId);
|
||||||
*((UINT32*)(ptr+BLOCK_ID_OFFSET)) = htonl((UINT32)startBlockId);
|
ptr[BLOCK_ID_OFFSET] = htonl((UINT32)startBlockId);
|
||||||
*((UINT16*)(ptr+BLOCK_LEN_OFFSET)) = htons((UINT16)startBlockLen);
|
((UINT16*)ptr)[BLOCK_LEN_OFFSET] = htons((UINT16)startBlockLen);
|
||||||
*((UINT16*)(ptr+SYMBOL_ID_OFFSET)) = htons((UINT16)startSymbolId);
|
((UINT16*)ptr)[SYMBOL_ID_OFFSET] = htons((UINT16)startSymbolId);
|
||||||
ptr += RepairItemLength();
|
ptr += (RepairItemLength()/4);
|
||||||
// range end
|
// range end
|
||||||
ptr[FEC_ID_OFFSET] = (char)129;
|
((UINT8*)ptr)[FEC_ID_OFFSET] = (char)129;
|
||||||
ptr[RESERVED_OFFSET] = 0;
|
((UINT8*)ptr)[RESERVED_OFFSET] = 0;
|
||||||
*((UINT16*)(ptr+OBJ_ID_OFFSET)) = htons((UINT16)endObjectId);
|
((UINT16*)ptr)[OBJ_ID_OFFSET] = htons((UINT16)endObjectId);
|
||||||
*((UINT32*)(ptr+BLOCK_ID_OFFSET)) = htonl((UINT32)endBlockId);
|
ptr[BLOCK_ID_OFFSET] = htonl((UINT32)endBlockId);
|
||||||
*((UINT16*)(ptr+BLOCK_LEN_OFFSET)) = htons((UINT16)endBlockLen);
|
((UINT16*)ptr)[BLOCK_LEN_OFFSET] = htons((UINT16)endBlockLen);
|
||||||
*((UINT16*)(ptr+SYMBOL_ID_OFFSET)) = htons((UINT16)endSymbolId);
|
((UINT16*)ptr)[SYMBOL_ID_OFFSET] = htons((UINT16)endSymbolId);
|
||||||
length += RepairRangeLength();
|
length += RepairRangeLength();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -211,13 +211,13 @@ bool NormRepairRequest::AppendErasureCount(const NormObjectId& objectId,
|
||||||
{
|
{
|
||||||
if (buffer_len >= (ITEM_LIST_OFFSET+length+ErasureItemLength()))
|
if (buffer_len >= (ITEM_LIST_OFFSET+length+ErasureItemLength()))
|
||||||
{
|
{
|
||||||
char* ptr = buffer + length + ITEM_LIST_OFFSET;
|
UINT32* ptr = buffer + (length + ITEM_LIST_OFFSET)/4;
|
||||||
ptr[FEC_ID_OFFSET] = (char)129;
|
((UINT8*)ptr)[FEC_ID_OFFSET] = (char)129;
|
||||||
ptr[RESERVED_OFFSET] = 0;
|
((UINT8*)ptr)[RESERVED_OFFSET] = 0;
|
||||||
*((UINT16*)(ptr+OBJ_ID_OFFSET)) = htons((UINT16)objectId);
|
((UINT16*)ptr)[OBJ_ID_OFFSET] = htons((UINT16)objectId);
|
||||||
*((UINT32*)(ptr+BLOCK_ID_OFFSET)) = htonl((UINT32)blockId);
|
ptr[BLOCK_ID_OFFSET] = htonl((UINT32)blockId);
|
||||||
*((UINT16*)(ptr+BLOCK_LEN_OFFSET)) = htons((UINT16)blockLen);
|
((UINT16*)ptr)[BLOCK_LEN_OFFSET] = htons((UINT16)blockLen);
|
||||||
*((UINT16*)(ptr+SYMBOL_ID_OFFSET)) = htons((UINT16)erasureCount);
|
((UINT16*)ptr)[SYMBOL_ID_OFFSET] = htons((UINT16)erasureCount);
|
||||||
length += ErasureItemLength();
|
length += ErasureItemLength();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -232,9 +232,9 @@ UINT16 NormRepairRequest::Pack()
|
||||||
{
|
{
|
||||||
if (length)
|
if (length)
|
||||||
{
|
{
|
||||||
buffer[FORM_OFFSET] = form;
|
((UINT8*)buffer)[FORM_OFFSET] = (UINT8)form;
|
||||||
buffer[FLAGS_OFFSET] = (char)flags;
|
((UINT8*)buffer)[FLAGS_OFFSET] = (UINT8)flags;
|
||||||
*((UINT16*)(buffer+LENGTH_OFFSET)) = htons(length);
|
((UINT16*)buffer)[LENGTH_OFFSET] = htons(length);
|
||||||
return (ITEM_LIST_OFFSET + length);
|
return (ITEM_LIST_OFFSET + length);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -244,18 +244,18 @@ UINT16 NormRepairRequest::Pack()
|
||||||
} // end NormRepairRequest::Pack()
|
} // end NormRepairRequest::Pack()
|
||||||
|
|
||||||
|
|
||||||
UINT16 NormRepairRequest::Unpack(const char* bufferPtr, UINT16 bufferLen)
|
UINT16 NormRepairRequest::Unpack(const UINT32* bufferPtr, UINT16 bufferLen)
|
||||||
{
|
{
|
||||||
buffer = (char*)bufferPtr;
|
buffer = (UINT32*)bufferPtr;
|
||||||
buffer_len = bufferLen;
|
buffer_len = bufferLen;
|
||||||
length = 0;
|
length = 0;
|
||||||
|
|
||||||
// Make sure there's at least a header
|
// Make sure there's at least a header
|
||||||
if (buffer_len >= ITEM_LIST_OFFSET)
|
if (buffer_len >= ITEM_LIST_OFFSET)
|
||||||
{
|
{
|
||||||
form = (Form)buffer[FORM_OFFSET];
|
form = (Form)((UINT8*)buffer)[FORM_OFFSET];
|
||||||
flags = (int)buffer[FLAGS_OFFSET];
|
flags = (int)((UINT8*)buffer)[FLAGS_OFFSET];
|
||||||
length = ntohs(*((UINT16*)(buffer+LENGTH_OFFSET)));
|
length = ntohs(((UINT16*)buffer)[LENGTH_OFFSET]);
|
||||||
if (length > (buffer_len - ITEM_LIST_OFFSET))
|
if (length > (buffer_len - ITEM_LIST_OFFSET))
|
||||||
{
|
{
|
||||||
// Badly formed message
|
// Badly formed message
|
||||||
|
|
@ -280,11 +280,11 @@ bool NormRepairRequest::RetrieveRepairItem(UINT16 offset,
|
||||||
{
|
{
|
||||||
if (length >= (offset + RepairItemLength()))
|
if (length >= (offset + RepairItemLength()))
|
||||||
{
|
{
|
||||||
const char* ptr = buffer+ITEM_LIST_OFFSET+offset;
|
const UINT32* ptr = buffer+(ITEM_LIST_OFFSET+offset)/4;
|
||||||
*objectId = ntohs(*((UINT16*)(ptr+OBJ_ID_OFFSET)));
|
*objectId = ntohs(((UINT16*)ptr)[OBJ_ID_OFFSET]);
|
||||||
*blockId = ntohl(*((UINT32*)(ptr+BLOCK_ID_OFFSET)));
|
*blockId = ntohl( ptr[BLOCK_ID_OFFSET]);
|
||||||
*blockLen = ntohs(*((UINT16*)(ptr+BLOCK_LEN_OFFSET)));
|
*blockLen = ntohs(((UINT16*)ptr)[BLOCK_LEN_OFFSET]);
|
||||||
*symbolId = ntohs(*((UINT16*)(ptr+SYMBOL_ID_OFFSET)));
|
*symbolId = ntohs(((UINT16*)ptr)[SYMBOL_ID_OFFSET]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -274,10 +274,12 @@ void NormServerNode::FreeBuffers()
|
||||||
while ((obj = rx_table.Find(rx_table.RangeLo())))
|
while ((obj = rx_table.Find(rx_table.RangeLo())))
|
||||||
{
|
{
|
||||||
session.Notify(NormController::RX_OBJECT_ABORTED, this, obj);
|
session.Notify(NormController::RX_OBJECT_ABORTED, this, obj);
|
||||||
|
UINT16 objectId = obj->GetId();
|
||||||
DeleteObject(obj);
|
DeleteObject(obj);
|
||||||
// We do the following to remember which objects were pending
|
// We do the following to remember which objects were pending
|
||||||
rx_pending_mask.Set(obj->GetId());
|
rx_pending_mask.Set(objectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
segment_pool.Destroy();
|
segment_pool.Destroy();
|
||||||
block_pool.Destroy();
|
block_pool.Destroy();
|
||||||
segment_size = ndata = nparity = 0;
|
segment_size = ndata = nparity = 0;
|
||||||
|
|
@ -605,7 +607,7 @@ void NormServerNode::HandleNackMessage(const NormNackMsg& nack)
|
||||||
// Clients use this method to process NACK content overheard from other
|
// Clients use this method to process NACK content overheard from other
|
||||||
// clients or via NORM_CMD(REPAIR_ADV) messages received from the server.
|
// clients or via NORM_CMD(REPAIR_ADV) messages received from the server.
|
||||||
// Such content can "suppress" pending NACKs
|
// Such content can "suppress" pending NACKs
|
||||||
void NormServerNode::HandleRepairContent(const char* buffer, UINT16 bufferLen)
|
void NormServerNode::HandleRepairContent(const UINT32* buffer, UINT16 bufferLen)
|
||||||
{
|
{
|
||||||
// Parse NACK and incorporate into repair state masks
|
// Parse NACK and incorporate into repair state masks
|
||||||
NormRepairRequest req;
|
NormRepairRequest req;
|
||||||
|
|
@ -619,7 +621,7 @@ void NormServerNode::HandleRepairContent(const char* buffer, UINT16 bufferLen)
|
||||||
while ((requestLength = req.Unpack(buffer, bufferLen)))
|
while ((requestLength = req.Unpack(buffer, bufferLen)))
|
||||||
{
|
{
|
||||||
// Point "buffer" to next request and adjust "bufferLen"
|
// Point "buffer" to next request and adjust "bufferLen"
|
||||||
buffer += requestLength;
|
buffer += (requestLength/4);
|
||||||
bufferLen -= requestLength;
|
bufferLen -= requestLength;
|
||||||
// Process request
|
// Process request
|
||||||
enum NormRequestLevel {SEGMENT, BLOCK, INFO, OBJECT};
|
enum NormRequestLevel {SEGMENT, BLOCK, INFO, OBJECT};
|
||||||
|
|
@ -1067,9 +1069,9 @@ void NormServerNode::HandleObjectMessage(const NormObjectMsg& msg)
|
||||||
// Reliable reception of this object has completed
|
// Reliable reception of this object has completed
|
||||||
if (NormObject::FILE == obj->GetType())
|
if (NormObject::FILE == obj->GetType())
|
||||||
#ifdef SIMULATE
|
#ifdef SIMULATE
|
||||||
((NormSimObject*)obj)->Close();
|
static_cast<NormSimObject*>(obj)->Close();
|
||||||
#else
|
#else
|
||||||
((NormFileObject*)obj)->Close();
|
static_cast<NormFileObject*>(obj)->Close();
|
||||||
#endif // !SIMULATE
|
#endif // !SIMULATE
|
||||||
if (NormObject::STREAM != obj->GetType())
|
if (NormObject::STREAM != obj->GetType())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -369,7 +369,7 @@ class NormServerNode : public NormNode
|
||||||
bool OnAckTimeout(ProtoTimer& theTimer);
|
bool OnAckTimeout(ProtoTimer& theTimer);
|
||||||
|
|
||||||
void AttachCCFeedback(NormAckMsg& ack);
|
void AttachCCFeedback(NormAckMsg& ack);
|
||||||
void HandleRepairContent(const char* buffer, UINT16 bufferLen);
|
void HandleRepairContent(const UINT32* buffer, UINT16 bufferLen);
|
||||||
|
|
||||||
UINT16 session_id;
|
UINT16 session_id;
|
||||||
bool synchronized;
|
bool synchronized;
|
||||||
|
|
|
||||||
|
|
@ -1763,7 +1763,6 @@ bool NormFileObject::Open(const char* thePath,
|
||||||
off_t size = file.GetSize();
|
off_t size = file.GetSize();
|
||||||
if (size)
|
if (size)
|
||||||
{
|
{
|
||||||
NormObjectSize osize((off_t)size);
|
|
||||||
if (!NormObject::Open(NormObjectSize(size),
|
if (!NormObject::Open(NormObjectSize(size),
|
||||||
infoPtr,
|
infoPtr,
|
||||||
infoLen,
|
infoLen,
|
||||||
|
|
|
||||||
|
|
@ -53,12 +53,14 @@ bool NormSegmentPool::Init(unsigned int count, unsigned int size)
|
||||||
void NormSegmentPool::Destroy()
|
void NormSegmentPool::Destroy()
|
||||||
{
|
{
|
||||||
ASSERT(seg_count == seg_total);
|
ASSERT(seg_count == seg_total);
|
||||||
char** ptr = (char**)seg_list;
|
char* ptr;
|
||||||
|
memcpy(&ptr, &seg_list, sizeof(char*));
|
||||||
while (ptr)
|
while (ptr)
|
||||||
{
|
{
|
||||||
char* next = *ptr;
|
char* next;
|
||||||
|
memcpy(&next, ptr, sizeof(char*));
|
||||||
delete ptr;
|
delete ptr;
|
||||||
ptr = (char**)next;
|
ptr = next;
|
||||||
}
|
}
|
||||||
seg_list = NULL;
|
seg_list = NULL;
|
||||||
seg_count = 0;
|
seg_count = 0;
|
||||||
|
|
@ -68,10 +70,10 @@ void NormSegmentPool::Destroy()
|
||||||
|
|
||||||
char* NormSegmentPool::Get()
|
char* NormSegmentPool::Get()
|
||||||
{
|
{
|
||||||
char** ptr = (char**)seg_list;
|
char* ptr = seg_list;
|
||||||
if (ptr)
|
if (ptr)
|
||||||
{
|
{
|
||||||
seg_list = *ptr;
|
memcpy(&seg_list, ptr, sizeof(char));
|
||||||
seg_count--;
|
seg_count--;
|
||||||
//#ifdef NORM_DEBUG
|
//#ifdef NORM_DEBUG
|
||||||
overrun_flag = false;
|
overrun_flag = false;
|
||||||
|
|
@ -88,7 +90,7 @@ char* NormSegmentPool::Get()
|
||||||
}
|
}
|
||||||
//#endif // NORM_DEBUG
|
//#endif // NORM_DEBUG
|
||||||
}
|
}
|
||||||
return ((char*)ptr);
|
return ptr;
|
||||||
} // end NormSegmentPool::GetSegment()
|
} // end NormSegmentPool::GetSegment()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,10 @@ class NormSegmentPool
|
||||||
void Put(char* segment)
|
void Put(char* segment)
|
||||||
{
|
{
|
||||||
ASSERT(seg_count < seg_total);
|
ASSERT(seg_count < seg_total);
|
||||||
char** ptr = (char**)segment;
|
//char** ptr = (char**)segment;
|
||||||
*ptr = seg_list;
|
//ptr = seg_list;
|
||||||
|
// (TBD) avoid this system call
|
||||||
|
memcpy(segment, &seg_list, sizeof(char*));
|
||||||
seg_list = segment;
|
seg_list = segment;
|
||||||
seg_count++;
|
seg_count++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1138,10 +1138,11 @@ void NormTrace(const struct timeval& currentTime,
|
||||||
const char* status = sent ? "dst" : "src";
|
const char* status = sent ? "dst" : "src";
|
||||||
const ProtoAddress& addr = sent ? msg.GetDestination() : msg.GetSource();
|
const ProtoAddress& addr = sent ? msg.GetDestination() : msg.GetSource();
|
||||||
|
|
||||||
|
UINT16 seq = msg.GetSequence();
|
||||||
struct tm* ct = gmtime((time_t*)¤tTime.tv_sec);
|
struct tm* ct = gmtime((time_t*)¤tTime.tv_sec);
|
||||||
DMSG(0, "trace>%02d:%02d:%02d.%06lu node>%lu %s>%s ",
|
DMSG(0, "trace>%02d:%02d:%02d.%06lu node>%lu %s>%s seq>%hu ",
|
||||||
ct->tm_hour, ct->tm_min, ct->tm_sec, currentTime.tv_usec,
|
ct->tm_hour, ct->tm_min, ct->tm_sec, currentTime.tv_usec,
|
||||||
(UINT32)localId, status, addr.GetHostString());
|
(UINT32)localId, status, addr.GetHostString(), seq);
|
||||||
bool clrFlag = false;
|
bool clrFlag = false;
|
||||||
switch (msgType)
|
switch (msgType)
|
||||||
{
|
{
|
||||||
|
|
@ -1165,9 +1166,10 @@ void NormTrace(const struct timeval& currentTime,
|
||||||
|
|
||||||
if (data.IsData())
|
if (data.IsData())
|
||||||
{
|
{
|
||||||
const UINT16* x = (const UINT16*)data.GetPayloadData();
|
UINT16 x;
|
||||||
|
memcpy(&x, data.GetPayloadData(), 2);
|
||||||
if (data.FlagIsSet(NormObjectMsg::FLAG_MSG_START))
|
if (data.FlagIsSet(NormObjectMsg::FLAG_MSG_START))
|
||||||
DMSG(0, "start byte>%hu ", ntohs(x[0]));
|
DMSG(0, "start byte>%hu ", ntohs(x));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -2582,6 +2584,7 @@ bool NormSession::SendMessage(NormMsg& msg)
|
||||||
case NormMsg::INFO:
|
case NormMsg::INFO:
|
||||||
case NormMsg::DATA:
|
case NormMsg::DATA:
|
||||||
((NormObjectMsg&)msg).SetSessionId(session_id);
|
((NormObjectMsg&)msg).SetSessionId(session_id);
|
||||||
|
msg.SetSequence(tx_sequence++); // (TBD) set for session dst msgs
|
||||||
break;
|
break;
|
||||||
case NormMsg::CMD:
|
case NormMsg::CMD:
|
||||||
((NormCmdMsg&)msg).SetSessionId(session_id);
|
((NormCmdMsg&)msg).SetSessionId(session_id);
|
||||||
|
|
@ -2594,6 +2597,7 @@ bool NormSession::SendMessage(NormMsg& msg)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
msg.SetSequence(tx_sequence++); // (TBD) set for session dst msgs
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NormMsg::NACK:
|
case NormMsg::NACK:
|
||||||
|
|
@ -2626,7 +2630,7 @@ bool NormSession::SendMessage(NormMsg& msg)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Fill in common message fields
|
// Fill in common message fields
|
||||||
msg.SetSequence(tx_sequence++);
|
|
||||||
msg.SetSourceId(local_node_id);
|
msg.SetSourceId(local_node_id);
|
||||||
UINT16 msgSize = msg.GetLength();
|
UINT16 msgSize = msg.GetLength();
|
||||||
bool result = true;
|
bool result = true;
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,9 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
//NormSetMessageTrace(session, true);
|
//NormSetMessageTrace(session, true);
|
||||||
|
|
||||||
NormSetTxLoss(session, 10.0); // 10% packet loss
|
NormSetTxLoss(session, 1.0); // 10% packet loss
|
||||||
|
|
||||||
NormSetGrttEstimate(session, 0.2);//0.001); // 1 msec initial grtt
|
NormSetGrttEstimate(session, 0.5);//0.001); // 1 msec initial grtt
|
||||||
|
|
||||||
NormSetTransmitRate(session, 1.0e+06); // in bits/second
|
NormSetTransmitRate(session, 1.0e+06); // in bits/second
|
||||||
|
|
||||||
|
|
@ -47,7 +47,7 @@ int main(int argc, char* argv[])
|
||||||
NormSetLoopback(session, true);
|
NormSetLoopback(session, true);
|
||||||
|
|
||||||
// Uncomment this line to participate as a receiver
|
// Uncomment this line to participate as a receiver
|
||||||
NormStartReceiver(session, 1024*1024);
|
//NormStartReceiver(session, 1024*1024);
|
||||||
|
|
||||||
// Uncomment the following line to start sender
|
// Uncomment the following line to start sender
|
||||||
NormStartSender(session, 1024*1024, 1024, 64, 0);
|
NormStartSender(session, 1024*1024, 1024, 64, 0);
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,6 @@
|
||||||
|
|
||||||
#ifndef _NORM_VERSION
|
#ifndef _NORM_VERSION
|
||||||
#define _NORM_VERSION
|
#define _NORM_VERSION
|
||||||
#define VERSION "1.2b6"
|
#define VERSION "1.2b7"
|
||||||
#endif // _NORM_VERSION
|
#endif // _NORM_VERSION
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ NS = ../ns
|
||||||
|
|
||||||
INCLUDES = $(SYSTEM_INCLUDES) -I$(UNIX) -I$(COMMON) -I$(PROTOLIB)/common
|
INCLUDES = $(SYSTEM_INCLUDES) -I$(UNIX) -I$(COMMON) -I$(PROTOLIB)/common
|
||||||
|
|
||||||
CFLAGS = -g -DPROTO_DEBUG -DUNIX -D_FILE_OFFSET_BITS=64 -O -fPIC $(SYSTEM_HAVES) $(INCLUDES)
|
CFLAGS = -g -DPROTO_DEBUG -DUNIX -D_FILE_OFFSET_BITS=64 -O -fPIC -Wall -pedantic -Wcast-align $(SYSTEM_HAVES) $(INCLUDES)
|
||||||
|
|
||||||
LDFLAGS = $(SYSTEM_LDFLAGS)
|
LDFLAGS = $(SYSTEM_LDFLAGS)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue