Commit 55a4a9c7 authored by kfox's avatar kfox

Create new fragmenter instances for new links created by ethernet listener with a fragmenter

parent 5d07462d
......@@ -122,6 +122,7 @@ _destroy(AthenaEthernetFragmenter **athenaEthernetFragmenter)
if ((*athenaEthernetFragmenter)->module) {
dlclose((*athenaEthernetFragmenter)->module);
}
parcMemory_Deallocate(&((*athenaEthernetFragmenter)->moduleName));
athenaTransportLink_Release(&((*athenaEthernetFragmenter)->athenaTransportLink));
}
......@@ -132,6 +133,7 @@ athenaEthernetFragmenter_Create(AthenaTransportLink *athenaTransportLink, const
{
AthenaEthernetFragmenter *athenaEthernetFragmenter = parcObject_CreateAndClearInstance(AthenaEthernetFragmenter);
assertNotNull(athenaEthernetFragmenter, "Could not create a new fragmenter instance.");
athenaEthernetFragmenter->moduleName = parcMemory_StringDuplicate(fragmenterName, strlen(fragmenterName));
athenaEthernetFragmenter->athenaTransportLink = athenaTransportLink_Acquire(athenaTransportLink);
const char *moduleLibrary = _nameToLibrary(fragmenterName);
......
......@@ -72,6 +72,7 @@ typedef void (AthenaEthernetFragmenter_Fini)(AthenaEthernetFragmenter *athenaEth
//
struct AthenaEthernetFragmenter {
AthenaTransportLink *athenaTransportLink; // link associated with fragmenter
const char *moduleName;
void *module; // so library can be unloaded
AthenaEthernetFragmenter_Send *send;
AthenaEthernetFragmenter_Receive *receive;
......
......@@ -419,7 +419,7 @@ _demuxDelivery(AthenaTransportLink *athenaTransportLink, CCNxMetaMessage *ccnxMe
// Use the same fragmentation as our parent
if (linkData->fragmenter) {
newLinkData->fragmenter = athenaEthernetFragmenter_Acquire(linkData->fragmenter);
newLinkData->fragmenter = athenaEthernetFragmenter_Create(athenaTransportLink, linkData->fragmenter->moduleName);
}
// We use our parents fd to send, and receive demux'd messages from our parent on our queue
......@@ -486,6 +486,8 @@ _ETHReceiveMessage(AthenaTransportLink *athenaTransportLink, struct ether_addr *
PARCBuffer *wireFormatBuffer = parcBuffer_Slice(message);
parcBuffer_Release(&message);
// If it's not a fragment returns our passed in wireFormatBuffer, otherwise it owns the buffer and eventually
// passes back the aggregated message after receiving all its fragments, returning NULL in the mean time.
wireFormatBuffer = athenaEthernetFragmenter_Receive(linkData->fragmenter, wireFormatBuffer);
if (wireFormatBuffer != NULL) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment