Commit 53168628 authored by Alan Walendowski's avatar Alan Walendowski

Use the new WireFormatMessage methods to modify an Interest in place when

sending back an InterestReturn.
parent 33b92693
...@@ -217,10 +217,19 @@ _processInterest(Athena *athena, CCNxInterest *interest, PARCBitVector *ingressV ...@@ -217,10 +217,19 @@ _processInterest(Athena *athena, CCNxInterest *interest, PARCBitVector *ingressV
if (egressVector != NULL) { if (egressVector != NULL) {
// If no links are in the egress vector the FIB returned, return a no route interest message // If no links are in the egress vector the FIB returned, return a no route interest message
if (parcBitVector_NumberOfBitsSet(egressVector) == 0) { if (parcBitVector_NumberOfBitsSet(egressVector) == 0) {
CCNxInterestReturn *interestReturn = ccnxInterestReturn_Create(interest, CCNxInterestReturn_ReturnCode_NoRoute); if (ccnxWireFormatMessage_ConvertInterestToInterestReturn(interest,
PARCBitVector *result = athenaTransportLinkAdapter_Send(athena->athenaTransportLinkAdapter, interestReturn, ingressVector); CCNxInterestReturn_ReturnCode_NoRoute)) {
parcBitVector_Release(&result);
ccnxInterestReturn_Release(&interestReturn); // NOTE: The Interest has been modified in-place. It is now an InterestReturn.
parcLog_Debug(athena->log, "Returning Interest as InterestReturn (code: NoRoute)");
PARCBitVector *result = athenaTransportLinkAdapter_Send(athena->athenaTransportLinkAdapter, interest,
ingressVector);
parcBitVector_Release(&result);
} else {
const char *name = ccnxName_ToString(ccnxName);
parcLog_Error(athena->log, "Unable to return Interest (%s) as InterestReturn (code: NoRoute).", name);
parcMemory_Deallocate(&name);
}
} else { } else {
parcBitVector_SetVector(expectedReturnVector, egressVector); parcBitVector_SetVector(expectedReturnVector, egressVector);
PARCBitVector *result = athenaTransportLinkAdapter_Send(athena->athenaTransportLinkAdapter, interest, egressVector); PARCBitVector *result = athenaTransportLinkAdapter_Send(athena->athenaTransportLinkAdapter, interest, egressVector);
...@@ -232,10 +241,21 @@ _processInterest(Athena *athena, CCNxInterest *interest, PARCBitVector *ingressV ...@@ -232,10 +241,21 @@ _processInterest(Athena *athena, CCNxInterest *interest, PARCBitVector *ingressV
parcBitVector_Release(&egressVector); parcBitVector_Release(&egressVector);
} else { } else {
// No FIB entry found, return a NoRoute interest return and remove the entry from the PIT. // No FIB entry found, return a NoRoute interest return and remove the entry from the PIT.
CCNxInterestReturn *interestReturn = ccnxInterestReturn_Create(interest, CCNxInterestReturn_ReturnCode_NoRoute);
PARCBitVector *result = athenaTransportLinkAdapter_Send(athena->athenaTransportLinkAdapter, interestReturn, ingressVector); if (ccnxWireFormatMessage_ConvertInterestToInterestReturn(interest,
parcBitVector_Release(&result); CCNxInterestReturn_ReturnCode_NoRoute)) {
ccnxInterestReturn_Release(&interestReturn);
// NOTE: The Interest has been modified in-place. It is now an InterestReturn.
parcLog_Debug(athena->log, "Returning Interest as InterestReturn (code: NoRoute)");
PARCBitVector *result = athenaTransportLinkAdapter_Send(athena->athenaTransportLinkAdapter, interest,
ingressVector);
parcBitVector_Release(&result);
} else {
const char *name = ccnxName_ToString(ccnxName);
parcLog_Error(athena->log, "Unable to return Interest (%s) as InterestReturn (code: NoRoute).", name);
parcMemory_Deallocate(&name);
}
const char *name = ccnxName_ToString(ccnxName); const char *name = ccnxName_ToString(ccnxName);
if (athenaPIT_RemoveInterest(athena->athenaPIT, interest, ingressVector) != true) { if (athenaPIT_RemoveInterest(athena->athenaPIT, interest, ingressVector) != true) {
parcLog_Error(athena->log, "Unable to remove interest (%s) from the PIT.", name); parcLog_Error(athena->log, "Unable to remove interest (%s) from the PIT.", name);
......
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