• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ parcMemory_Deallocate函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中parcMemory_Deallocate函数的典型用法代码示例。如果您正苦于以下问题:C++ parcMemory_Deallocate函数的具体用法?C++ parcMemory_Deallocate怎么用?C++ parcMemory_Deallocate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了parcMemory_Deallocate函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: athenaTransportLinkAdapter_Destroy

void
athenaTransportLinkAdapter_Destroy(AthenaTransportLinkAdapter **athenaTransportLinkAdapter)
{
    // release listener instances
    if ((*athenaTransportLinkAdapter)->listenerList) {
        for (int index = 0; index < parcArrayList_Size((*athenaTransportLinkAdapter)->listenerList); index++) {
            AthenaTransportLink *athenaTransportLink = parcArrayList_Get((*athenaTransportLinkAdapter)->listenerList, index);
            athenaTransportLink_Close(athenaTransportLink);
        }
    }
    // release live instances
    if ((*athenaTransportLinkAdapter)->instanceList) {
        for (int index = 0; index < parcArrayList_Size((*athenaTransportLinkAdapter)->instanceList); index++) {
            AthenaTransportLink *athenaTransportLink = parcArrayList_Get((*athenaTransportLinkAdapter)->instanceList, index);
            if (athenaTransportLink) {
                athenaTransportLink_Close(athenaTransportLink);
            }
        }
    }
    parcArrayList_Destroy(&((*athenaTransportLinkAdapter)->moduleList));
    parcArrayList_Destroy(&((*athenaTransportLinkAdapter)->instanceList));
    parcArrayList_Destroy(&((*athenaTransportLinkAdapter)->listenerList));
    if ((*athenaTransportLinkAdapter)->pollfdReceiveList) {
        parcMemory_Deallocate(&((*athenaTransportLinkAdapter)->pollfdReceiveList));
        parcMemory_Deallocate(&((*athenaTransportLinkAdapter)->pollfdSendList));
        parcMemory_Deallocate(&((*athenaTransportLinkAdapter)->pollfdTransportLink));
    }
    parcLog_Release(&((*athenaTransportLinkAdapter)->log));
    parcMemory_Deallocate(athenaTransportLinkAdapter);
}
开发者ID:chris-wood,项目名称:ghost,代码行数:30,代码来源:athena_TransportLinkAdapter.c


示例2: _PIT_Command

static CCNxMetaMessage *
_PIT_Command(Athena *athena, CCNxInterest *interest)
{
    CCNxMetaMessage *responseMessage;
    responseMessage = athenaPIT_ProcessMessage(athena->athenaPIT, interest);
    if (responseMessage) {
        return responseMessage;
    }

    CCNxName *ccnxName = ccnxInterest_GetName(interest);
    if (ccnxName_GetSegmentCount(ccnxName) > AthenaCommandSegment) {
        CCNxNameSegment *nameSegment = ccnxName_GetSegment(ccnxName, AthenaCommandSegment);
        char *command = ccnxNameSegment_ToString(nameSegment);

        if (strcasecmp(command, AthenaCommand_List) == 0) {
            parcLog_Debug(athena->log, "PIT List command invoked");
            PARCList *pitEntries = athenaPIT_CreateEntryList(athena->athenaPIT);
            printf("\n");
            for (size_t i = 0; i < parcList_Size(pitEntries); ++i) {
                PARCBuffer *strbuf = parcList_GetAtIndex(pitEntries, i);
                char *toprint = parcBuffer_ToString(strbuf);
                parcLog_Info(athena->log, "%s\n", toprint);
                parcMemory_Deallocate(&toprint);
            }
            parcList_Release(&pitEntries);
            responseMessage = _create_response(athena, ccnxName, "PIT listed on forwarder output log.");
        } else {
            responseMessage = _create_response(athena, ccnxName, "Unknown command: %s", command);
        }

        parcMemory_Deallocate(&command);
    }
    return responseMessage;
}
开发者ID:PARC,项目名称:Athena,代码行数:34,代码来源:athena_InterestControl.c


示例3: _createInterestResponse

/**
 * Given a CCnxInterest that matched our domain prefix, see what the embedded command is and
 * create a corresponding CCNxContentObject as a response. The resulting CCNxContentObject
 * must eventually be released by calling ccnxContentObject_Release().
 *
 * @param [in] interest A CCNxInterest that matched the specified domain prefix.
 * @param [in] domainPrefix A CCNxName containing the domain prefix.
 * @param [in] directoryPath A string containing the path to the directory being served.
 *
 * @return A newly creatd CCNxContentObject contaning a response to the specified Interest,
 *         or NULL if the Interest couldn't be answered.
 */
static CCNxContentObject *
_createInterestResponse(const CCNxInterest *interest, const CCNxName *domainPrefix, const char *directoryPath)
{
    CCNxName *interestName = ccnxInterest_GetName(interest);

    char *command = tutorialCommon_CreateCommandStringFromName(interestName, domainPrefix);

    uint64_t requestedChunkNumber = tutorialCommon_GetChunkNumberFromName(interestName);

    char *interestNameString = ccnxName_ToString(interestName);
    printf("tutorialServer: received Interest for chunk %d of %s, command = %s\n",
           (int) requestedChunkNumber, interestNameString, command);
    parcMemory_Deallocate((void **) &interestNameString);

    CCNxContentObject *result = NULL;
    if (strncasecmp(command, tutorialCommon_CommandList, strlen(command)) == 0) {
        // This was a 'list' command. We should return the requested chunk of the directory listing.
        result = _createListResponse(interestName, directoryPath, requestedChunkNumber);
    } else if (strncasecmp(command, tutorialCommon_CommandFetch, strlen(command)) == 0) {
        // This was a 'fetch' command. We should return the requested chunk of the file specified.
        char *fileName = tutorialCommon_CreateFileNameFromName(interestName);
        result = _createFetchResponse(interestName, directoryPath, fileName, requestedChunkNumber);
        parcMemory_Deallocate((void **) &fileName);
    }

    parcMemory_Deallocate((void **) &command);

    return result;
}
开发者ID:Emat12,项目名称:ccnx-tutorial,代码行数:41,代码来源:tutorial_Server.c


示例4: _metisStreamConnection_DestroyOperations

static void
_metisStreamConnection_DestroyOperations(MetisIoOperations **opsPtr)
{
    assertNotNull(opsPtr, "Parameter opsPtr must be non-null double pointer");
    assertNotNull(*opsPtr, "Parameter opsPtr must dereference to non-null pointer");

    MetisIoOperations *ops = *opsPtr;
    assertNotNull(metisIoOperations_GetClosure(ops), "ops->context must not be null");

    _MetisStreamState *stream = (_MetisStreamState *) metisIoOperations_GetClosure(ops);

    parcEventQueue_Destroy(&stream->bufferEventVector);

    metisAddressPair_Release(&stream->addressPair);

    if (!stream->isClosed) {
        stream->isClosed = true;
        metisMessenger_Send(metisForwarder_GetMessenger(stream->metis), metisMissive_Create(MetisMissiveType_ConnectionClosed, stream->id));
    }

    metisMessenger_Send(metisForwarder_GetMessenger(stream->metis), metisMissive_Create(MetisMissiveType_ConnectionDestroyed, stream->id));

    if (metisLogger_IsLoggable(stream->logger, MetisLoggerFacility_IO, PARCLogLevel_Info)) {
        metisLogger_Log(stream->logger, MetisLoggerFacility_IO, PARCLogLevel_Info, __func__,
                        "StreamConnection %p destroyed", (void *) stream);
    }

    metisLogger_Release(&stream->logger);
    parcMemory_Deallocate((void **) &stream);
    parcMemory_Deallocate((void **) &ops);

    *opsPtr = NULL;
}
开发者ID:isolis,项目名称:Metis,代码行数:33,代码来源:metis_StreamConnection.c


示例5: athena_ProcessMessage

void
athena_ProcessMessage(Athena *athena, CCNxMetaMessage *ccnxMessage, PARCBitVector *ingressVector)
{
    if (ccnxMetaMessage_IsInterest(ccnxMessage)) {
        const char *name = ccnxName_ToString(ccnxInterest_GetName(ccnxMessage));
        parcLog_Debug(athena->log, "Processing Interest Message: %s", name);
        parcMemory_Deallocate(&name);

        CCNxInterest *interest = ccnxMetaMessage_GetInterest(ccnxMessage);
        _processInterest(athena, interest, ingressVector);
        athena->stats.numProcessedInterests++;
    } else if (ccnxMetaMessage_IsContentObject(ccnxMessage)) {
        const char *name = ccnxName_ToString(ccnxContentObject_GetName(ccnxMessage));
        parcLog_Debug(athena->log, "Processing Content Object Message: %s", name);
        parcMemory_Deallocate(&name);

        CCNxContentObject *contentObject = ccnxMetaMessage_GetContentObject(ccnxMessage);
        _processContentObject(athena, contentObject, ingressVector);
        athena->stats.numProcessedContentObjects++;
    } else if (ccnxMetaMessage_IsControl(ccnxMessage)) {
        parcLog_Debug(athena->log, "Processing Control Message");

        CCNxControl *control = ccnxMetaMessage_GetControl(ccnxMessage);
        _processControl(athena, control, ingressVector);
        athena->stats.numProcessedControlMessages++;
    } else if (ccnxMetaMessage_IsInterestReturn(ccnxMessage)) {
        parcLog_Debug(athena->log, "Processing Interest Return Message");

        CCNxInterestReturn *interestReturn = ccnxMetaMessage_GetInterestReturn(ccnxMessage);
        _processInterestReturn(athena, interestReturn, ingressVector);
        athena->stats.numProcessedInterestReturns++;
    } else {
        trapUnexpectedState("Invalid CCNxMetaMessage type");
    }
}
开发者ID:chris-wood,项目名称:ghost,代码行数:35,代码来源:athena.c


示例6: LONGBOW_TEST_CASE

LONGBOW_TEST_CASE(JSON, parcJSON_BuildString)
{
    TestData *data = longBowTestCase_GetClipBoardData(testCase);
    PARCBufferComposer *composer = parcBufferComposer_Create();
    parcJSON_BuildString(data->json, composer, false);

    PARCBuffer *tempBuffer = parcBufferComposer_ProduceBuffer(composer);
    char *actual = parcBuffer_ToString(tempBuffer);
    parcBuffer_Release(&tempBuffer);
    parcBufferComposer_Release(&composer);

    assertTrue(strcmp(data->expected, actual) == 0, "Expected %s, actual %s", data->expected, actual);
    parcMemory_Deallocate((void **) &actual);

    composer = parcBufferComposer_Create();
    parcJSON_BuildString(data->json, composer, true);

    tempBuffer = parcBufferComposer_ProduceBuffer(composer);
    actual = parcBuffer_ToString(tempBuffer);
    parcBuffer_Release(&tempBuffer);
    parcBufferComposer_Release(&composer);

    assertTrue(strcmp(data->compactExpected, actual) == 0, "Expected %s, actual %s", data->compactExpected, actual);
    parcMemory_Deallocate((void **) &actual);
}
开发者ID:PARC,项目名称:Libparc,代码行数:25,代码来源:test_parc_JSON.c


示例7: _expand

static void
_expand(PARCHashCodeTable *hashCodeTable)
{
    LinearAddressingHashTable temp_table;
    LinearAddressingHashTable *old_table = &hashCodeTable->hashtable;

    size_t expandby = EXPAND_FACTOR;

    // start with a copy of the current table
    PARCHashCodeTable_AddResult result = ADD_OK;
    do {
        hashCodeTable->expandCount++;

        temp_table.tableSize = 0;
        temp_table.tableLimit = old_table->tableLimit * expandby;
        temp_table.expandThreshold = temp_table.tableLimit - temp_table.tableLimit / 4;
        temp_table.entries = parcMemory_AllocateAndClear(temp_table.tableLimit * sizeof(HashTableEntry));
        assertNotNull(temp_table.entries, "parcMemory_AllocateAndClear(%zu) returned NULL", temp_table.tableLimit * sizeof(HashTableEntry));

        result = _rehash(old_table, &temp_table, hashCodeTable->keyEqualsFunc);
        if (result == ADD_NOSPACE) {
            // could not rehash, so expand by more and try again
            parcMemory_Deallocate((void **) &(temp_table.entries));
            expandby++;
        }
    } while (result == ADD_NOSPACE);

    parcMemory_Deallocate((void **) &old_table->entries);
    hashCodeTable->hashtable = temp_table;
}
开发者ID:PARC,项目名称:Libparc,代码行数:30,代码来源:parc_HashCodeTable.c


示例8: _TemplateLinkData_Destroy

static void
_TemplateLinkData_Destroy(_TemplateLinkData **linkData)
{
    parcMemory_Deallocate(&((*linkData)->linkIdentity));
    parcDeque_Release(&((*linkData)->queue));
    parcMemory_Deallocate(linkData);
}
开发者ID:mahyuddin,项目名称:Athena,代码行数:7,代码来源:athena_TransportLinkModuleTEMPLATE.c


示例9: _receiveContentObject

/**
 * Receive a ContentObject message that comes back from the tutorial_Server in response to an Interest we sent.
 * This message will be a chunk of the requested content, and should be received in ordered sequence.
 * Depending on the CCNxName in the content object, we hand it off to either _receiveFileChunk() or
 * _receiveDirectoryListingChunk() to process.
 *
 * @param [in] contentObject A CCNxContentObject containing a response to an CCNxInterest we sent.
 * @param [in] domainPrefix A CCNxName containing the domain prefix of the content we requested.
 *
 * @return The number of chunks of the content left to transfer.
 */
static uint64_t
_receiveContentObject(CCNxContentObject *contentObject, const CCNxName *domainPrefix)
{
    CCNxName *contentName = ccnxContentObject_GetName(contentObject);

    uint64_t chunkNumber = tutorialCommon_GetChunkNumberFromName(contentName);

    // Get the number of the final chunk, as specified by the sender.
    uint64_t finalChunkNumberSpecifiedByServer = ccnxContentObject_GetFinalChunkNumber(contentObject);

    // Get the type of the incoming message. Was it a response to a fetch' or a 'list' command?
    char *command = tutorialCommon_CreateCommandStringFromName(contentName, domainPrefix);

    // Process the payload.
    PARCBuffer *payload = ccnxContentObject_GetPayload(contentObject);

    if (strncasecmp(command, tutorialCommon_CommandList, strlen(command)) == 0) {
        // This is a chunk of the directory listing.
        _receiveDirectoryListingChunk(payload, chunkNumber, finalChunkNumberSpecifiedByServer);
    } else if (strncasecmp(command, tutorialCommon_CommandFetch, strlen(command)) == 0) {
        // This is a chunk of a file.
        char *fileName = tutorialCommon_CreateFileNameFromName(contentName);
        _receiveFileChunk(fileName, payload, chunkNumber, finalChunkNumberSpecifiedByServer);
        parcMemory_Deallocate((void **) &fileName);
    } else {
        printf("tutorial_Client: Unknown command: %s\n", command);
    }

    parcMemory_Deallocate((void **) &command);

    return (finalChunkNumberSpecifiedByServer - chunkNumber); // number of chunks left to transfer
}
开发者ID:isolis,项目名称:ccnx-tutorial,代码行数:43,代码来源:tutorial_Client.c


示例10: LONGBOW_TEST_CASE

LONGBOW_TEST_CASE(parc_JSONArray, parcJSONArray_BuildString)
{
    PARCJSONArray *array = parcJSONArray_Create();
    PARCJSONValue *expected = parcJSONValue_CreateFromInteger(10);
    parcJSONArray_AddValue(array, expected);

    PARCBufferComposer *composer = parcBufferComposer_Create();
    parcJSONArray_BuildString(array, composer, false);

    PARCBuffer *tempBuffer = parcBufferComposer_ProduceBuffer(composer);
    parcBufferComposer_Release(&composer);
    char *result = parcBuffer_ToString(tempBuffer);
    parcBuffer_Release(&tempBuffer);

    assertTrue(strlen(result) > 0, "Expected non-empty string result");

    parcMemory_Deallocate((void **) &result);

    composer = parcBufferComposer_Create();
    parcJSONArray_BuildString(array, composer, true);
    tempBuffer = parcBufferComposer_ProduceBuffer(composer);
    parcBufferComposer_Release(&composer);
    result = parcBuffer_ToString(tempBuffer);
    parcBuffer_Release(&tempBuffer);

    assertTrue(strlen(result) > 0, "Expected non-empty string result");

    parcMemory_Deallocate((void **) &result);

    parcJSONValue_Release(&expected);
    parcJSONArray_Release(&array);
}
开发者ID:isolis,项目名称:Libparc,代码行数:32,代码来源:test_parc_JSONArray.c


示例11: ccnxManifestHashGroup_ToJson

PARCJSON *
ccnxManifestHashGroup_ToJson(const CCNxManifestHashGroup *group)
{
    PARCJSON *root = parcJSON_Create();

    PARCJSONArray *ptrList = parcJSONArray_Create();
    for (size_t i = 0; i < parcLinkedList_Size(group->pointers); i++) {
        CCNxManifestHashGroupPointer *ptr = (CCNxManifestHashGroupPointer *) parcLinkedList_GetAtIndex(group->pointers, i);
        PARCJSON *ptrJson = parcJSON_Create();

        // Type.
        parcJSON_AddInteger(ptrJson, "type", ccnxManifestHashGroupPointer_GetType(ptr));

        // Digest.
        char *digestString = parcBuffer_ToHexString(ptr->digest);
        parcJSON_AddString(ptrJson, "digest", digestString);
        parcMemory_Deallocate(&digestString);

        // Add the tuple to the list.
        PARCJSONValue *val = parcJSONValue_CreateFromJSON(ptrJson);
        parcJSONArray_AddValue(ptrList, val);

        // Cleanup
        parcJSONValue_Release(&val);
        parcJSON_Release(&ptrJson);
    }
    root = parcJSON_AddArray(root, "HashGroup", ptrList);
    parcJSONArray_Release(&ptrList);

    if (group->overallDataDigest != NULL) {
        char *digestString = parcBuffer_ToHexString(group->overallDataDigest);
        root = parcJSON_AddString(root, "overallDataDigest", digestString);
        parcMemory_Deallocate((void **) &digestString);
    }

    if (group->locator != NULL) {
        char *locatorString = ccnxName_ToString(group->locator);
        root = parcJSON_AddString(root, "locator", locatorString);
        parcMemory_Deallocate((void **) &locatorString);
    }

    if (group->entrySize > 0) {
        root = parcJSON_AddInteger(root, "entrySize", group->entrySize);
    }

    if (group->dataSize > 0) {
        root = parcJSON_AddInteger(root, "dataSize", group->dataSize);
    }

    if (group->blockSize > 0) {
        root = parcJSON_AddInteger(root, "blockSize", group->blockSize);
    }

    if (group->treeHeight > 0) {
        root = parcJSON_AddInteger(root, "treeHeight", group->treeHeight);
    }

    return root;
}
开发者ID:rayyagar,项目名称:Libccnx-common,代码行数:59,代码来源:ccnx_ManifestHashGroup.c


示例12: _Control_Command_Set

static CCNxMetaMessage *
_Control_Command_Set(Athena *athena, CCNxName *ccnxName, const char *command)
{
    CCNxMetaMessage *responseMessage = NULL;

    if (ccnxName_GetSegmentCount(ccnxName) <= (AthenaCommandSegment + 2)) {
        responseMessage = _create_response(athena, ccnxName, "Athena set arguments required <name> <value>");
        return responseMessage;
    }
    // Check for required set name argument
    CCNxNameSegment *nameSegment = ccnxName_GetSegment(ccnxName, AthenaCommandSegment + 1);
    char *name = ccnxNameSegment_ToString(nameSegment);
    if (strcasecmp(name, AthenaCommand_LogLevel) == 0) {
        // Check the level to set the log to
        nameSegment = ccnxName_GetSegment(ccnxName, AthenaCommandSegment + 2);
        char *level = ccnxNameSegment_ToString(nameSegment);
        if (strcasecmp(level, AthenaCommand_LogDebug) == 0) {
            athenaTransportLinkAdapter_SetLogLevel(athena->athenaTransportLinkAdapter, PARCLogLevel_Debug);
            parcLog_SetLevel(athena->log, PARCLogLevel_Debug);
            athenaInterestControl_LogConfigurationChange(athena, ccnxName, NULL);
            responseMessage = _create_response(athena, ccnxName, "set athena logging level to %s", AthenaCommand_LogDebug);
        } else if (strcasecmp(level, AthenaCommand_LogInfo) == 0) {
            athenaTransportLinkAdapter_SetLogLevel(athena->athenaTransportLinkAdapter, PARCLogLevel_Info);
            parcLog_SetLevel(athena->log, PARCLogLevel_Info);
            athenaInterestControl_LogConfigurationChange(athena, ccnxName, NULL);
            responseMessage = _create_response(athena, ccnxName, "set athena logging level to %s", AthenaCommand_LogInfo);
        } else if (strcasecmp(level, AthenaCommand_LogOff) == 0) {
            athenaTransportLinkAdapter_SetLogLevel(athena->athenaTransportLinkAdapter, PARCLogLevel_Off);
            parcLog_SetLevel(athena->log, PARCLogLevel_Off);
            athenaInterestControl_LogConfigurationChange(athena, ccnxName, NULL);
            responseMessage = _create_response(athena, ccnxName, "set athena logging level to %s", AthenaCommand_LogOff);
        } else if (strcasecmp(level, AthenaCommand_LogAll) == 0) {
            athenaTransportLinkAdapter_SetLogLevel(athena->athenaTransportLinkAdapter, PARCLogLevel_All);
            parcLog_SetLevel(athena->log, PARCLogLevel_All);
            athenaInterestControl_LogConfigurationChange(athena, ccnxName, NULL);
            responseMessage = _create_response(athena, ccnxName, "set athena logging level to %s", AthenaCommand_LogAll);
        } else if (strcasecmp(level, AthenaCommand_LogError) == 0) {
            athenaTransportLinkAdapter_SetLogLevel(athena->athenaTransportLinkAdapter, PARCLogLevel_Error);
            parcLog_SetLevel(athena->log, PARCLogLevel_Error);
            athenaInterestControl_LogConfigurationChange(athena, ccnxName, NULL);
            responseMessage = _create_response(athena, ccnxName, "set athena logging level to %s", AthenaCommand_LogError);
        } else if (strcasecmp(level, AthenaCommand_LogNotice) == 0) {
            athenaTransportLinkAdapter_SetLogLevel(athena->athenaTransportLinkAdapter, PARCLogLevel_Notice);
            parcLog_SetLevel(athena->log, PARCLogLevel_Notice);
            athenaInterestControl_LogConfigurationChange(athena, ccnxName, NULL);
            responseMessage = _create_response(athena, ccnxName, "set athena logging level to %s", AthenaCommand_LogNotice);
        } else {
            responseMessage = _create_response(athena, ccnxName, "unknown logging level (%s)", level);
        }
        parcMemory_Deallocate(&level);
    } else {
        responseMessage = _create_response(athena, ccnxName, "Athena unknown set name (%s)", name);
    }

    parcMemory_Deallocate(&name);
    return responseMessage;
}
开发者ID:PARC,项目名称:Athena,代码行数:57,代码来源:athena_InterestControl.c


示例13: _metisConfiguration_AddConnectionEthernet

static bool
_metisConfiguration_AddConnectionEthernet(MetisConfiguration *config, CPIConnectionEthernet *etherConn, CPIAddress *linkAddress, MetisListenerOps *listenerOps)
{
    bool success = false;

    const char *symbolic = cpiConnectionEthernet_GetSymbolicName(etherConn);
    if (!metisSymbolicNameTable_Exists(config->symbolicNameTable, symbolic)) {
        const CPIAddress *remote = cpiConnectionEthernet_GetPeerLinkAddress(etherConn);
        MetisAddressPair *pair = metisAddressPair_Create(linkAddress, remote);

        MetisGenericEther *ether = metisEtherListener_GetGenericEtherFromListener(listenerOps);

        if (ether) {
            MetisIoOperations *ops = metisEtherConnection_Create(config->metis, ether, pair);

            if (ops) {
                MetisConnection *conn = metisConnection_Create(ops);
                assertNotNull(conn, "Failed to create connection");

                metisConnectionTable_Add(metisForwarder_GetConnectionTable(config->metis), conn);
                metisSymbolicNameTable_Add(config->symbolicNameTable, symbolic, metisConnection_GetConnectionId(conn));

                success = true;

                if (metisLogger_IsLoggable(config->logger, MetisLoggerFacility_Config, PARCLogLevel_Debug)) {
                    char *peerAddressString = cpiAddress_ToString(remote);
                    metisLogger_Log(config->logger, MetisLoggerFacility_Config, PARCLogLevel_Debug, __func__,
                                    "Add connection %s on %s to %s, connid %u",
                                    symbolic,
                                    cpiConnectionEthernet_GetInterfaceName(etherConn),
                                    peerAddressString,
                                    metisConnection_GetConnectionId(conn));
                    parcMemory_Deallocate((void **) &peerAddressString);
                }
            }
        } else {
            metisLogger_Log(config->logger, MetisLoggerFacility_Config, PARCLogLevel_Error, __func__,
                            "Could not get MetisGenericEther for listener %p",
                            listenerOps);
        }

        metisAddressPair_Release(&pair);
    } else {
        if (metisLogger_IsLoggable(config->logger, MetisLoggerFacility_Config, PARCLogLevel_Warning)) {
            const CPIAddress *remote = cpiConnectionEthernet_GetPeerLinkAddress(etherConn);
            char *peerAddressString = cpiAddress_ToString(remote);
            metisLogger_Log(config->logger, MetisLoggerFacility_Config, PARCLogLevel_Warning, __func__,
                            "Add connection %s on %s to %s failed, symbolic name exists",
                            symbolic,
                            cpiConnectionEthernet_GetInterfaceName(etherConn),
                            peerAddressString);
            parcMemory_Deallocate((void **) &peerAddressString);
        }
    }

    return success;
}
开发者ID:PARC,项目名称:Metis,代码行数:57,代码来源:metis_Configuration.c


示例14: _TransportLinkAdapter_Command

static CCNxMetaMessage *
_TransportLinkAdapter_Command(Athena *athena, CCNxInterest *interest)
{
    CCNxMetaMessage *responseMessage;
    responseMessage = athenaTransportLinkAdapter_ProcessMessage(athena->athenaTransportLinkAdapter, interest);
    if (responseMessage) {
        return responseMessage;
    }

    CCNxName *ccnxName = ccnxInterest_GetName(interest);
    if (ccnxName_GetSegmentCount(ccnxName) > AthenaCommandSegment) {
        CCNxNameSegment *nameSegment = ccnxName_GetSegment(ccnxName, AthenaCommandSegment);
        char *command = ccnxNameSegment_ToString(nameSegment);

        char *arguments = _get_arguments(interest);
        if (arguments == NULL) {
            responseMessage = _create_response(athena, ccnxName, "No link arguments given to %s command", command);
            parcMemory_Deallocate(&command);
            return responseMessage;
        }

        if (strcasecmp(command, AthenaCommand_Add) == 0) {
            if (arguments) {
                PARCURI *connectionURI = parcURI_Parse(arguments);
                if (connectionURI == NULL) {
                    responseMessage = _create_response(athena, ccnxName, "Could not parse URI:  %s", arguments);
                    return responseMessage;
                }
                const char *linkName = athenaTransportLinkAdapter_Open(athena->athenaTransportLinkAdapter, connectionURI);
                parcURI_Release(&connectionURI);
                if (linkName) {
                    responseMessage = _create_response(athena, ccnxName, "%s", linkName);
                    athenaInterestControl_LogConfigurationChange(athena, ccnxName, "%s", arguments);
                } else {
                    responseMessage = _create_response(athena, ccnxName, "New %s link failed: %s", arguments, strerror(errno));
                }
            }
        } else if (strcasecmp(command, AthenaCommand_Remove) == 0) {
            if (arguments) {
                int result = athenaTransportLinkAdapter_CloseByName(athena->athenaTransportLinkAdapter, arguments);
                if (result) {
                    responseMessage = _create_response(athena, ccnxName, "removal of %s failed", arguments);
                } else {
                    responseMessage = _create_response(athena, ccnxName, "%s removed", arguments);
                    athenaInterestControl_LogConfigurationChange(athena, ccnxName, "%s", arguments);
                }
            }
        } else {
            responseMessage = _create_response(athena, ccnxName, "Unknown TransportLinkAdapter command %s", command);
        }

        parcMemory_Deallocate(&command);
        parcMemory_Deallocate(&arguments);
    }
    return responseMessage;
}
开发者ID:PARC,项目名称:Athena,代码行数:56,代码来源:athena_InterestControl.c


示例15: _parcLogger_Destroy

static void
_parcLogger_Destroy(PARCLog **loggerPtr)
{
    PARCLog *logger = *loggerPtr;

    parcMemory_Deallocate((void **) &logger->hostName);
    parcMemory_Deallocate((void **) &logger->applicationName);
    parcMemory_Deallocate((void **) &logger->processId);
    parcLogReporter_Release(&logger->reporter);
}
开发者ID:isolis,项目名称:Libparc,代码行数:10,代码来源:parc_Log.c


示例16: _parcLogEntry_Destroy

static void
_parcLogEntry_Destroy(PARCLogEntry **entryPtr)
{
    PARCLogEntry *entry = *entryPtr;

    parcMemory_Deallocate((void **) &entry->hostName);
    parcMemory_Deallocate((void **) &entry->applicationName);
    parcMemory_Deallocate((void **) &entry->processName);
    parcBuffer_Release(&entry->payload);
}
开发者ID:PARC,项目名称:Libparc,代码行数:10,代码来源:parc_LogEntry.c


示例17: _strategyAll_ImplDestroy

static void
_strategyAll_ImplDestroy(MetisStrategyImpl **strategyPtr)
{
    assertNotNull(strategyPtr, "Parameter must be non-null double pointer");
    assertNotNull(*strategyPtr, "Parameter must dereference to non-null pointer");

    MetisStrategyImpl *impl = *strategyPtr;
    StrategyAll *strategy = (StrategyAll *) impl->context;

    parcMemory_Deallocate((void **) &strategy);
    parcMemory_Deallocate((void **) &impl);
    *strategyPtr = NULL;
}
开发者ID:PARC,项目名称:Metis,代码行数:13,代码来源:strategy_All.c


示例18: _metisCliSession_Destory

/**
 * SHOULD ONLY BE CALLED FROM ARRAYLIST
 *
 *   Do not call this on your own!!  It should only be called when an
 *   item is removed from the cli->openSessions array list.
 *
 *   Will close the tcp session and free memory.
 *
 * @param <#param1#>
 *
 * Example:
 * @code
 * <#example#>
 * @endcode
 */
static void
_metisCliSession_Destory(_MetisCommandLineInterface_Session **cliSessionPtr)
{
    assertNotNull(cliSessionPtr, "Parameter must be non-null double pointer");
    assertNotNull(*cliSessionPtr, "Parameter must dereference to non-null pointer");
    _MetisCommandLineInterface_Session *session = *cliSessionPtr;

    assertTrue(session->doingTheRightThing, "Ha! caught you!  You called Destroy outside the PARCArrayList");

    parcEventQueue_Destroy(&(session->streamBuffer));
    parcMemory_Deallocate((void **) &(session->clientAddress));
    parcMemory_Deallocate((void **) &session);
    *cliSessionPtr = NULL;
}
开发者ID:isolis,项目名称:Metis,代码行数:29,代码来源:metis_CommandLineInterface.c


示例19: athenaTransportLinkModule_Destroy

void
athenaTransportLinkModule_Destroy(AthenaTransportLinkModule **athenaTransportLinkModule)
{
    int index = (int) parcArrayList_Size((*athenaTransportLinkModule)->instanceList);
    while (index-- > 0) {
        AthenaTransportLink *transportLink;
        transportLink = parcArrayList_Get((*athenaTransportLinkModule)->instanceList, 0);
        athenaTransportLink_Close(transportLink);
    }
    parcArrayList_Destroy(&((*athenaTransportLinkModule)->instanceList));
    parcMemory_Deallocate(&((*athenaTransportLinkModule)->name));
    parcLog_Release(&((*athenaTransportLinkModule)->log));
    parcMemory_Deallocate(athenaTransportLinkModule);
}
开发者ID:PARC,项目名称:Athena,代码行数:14,代码来源:athena_TransportLinkModule.c


示例20: LONGBOW_TEST_CASE

LONGBOW_TEST_CASE(Global, parcNotifier_ThreadedTest)
{
    TestData *data = parcMemory_AllocateAndClear(sizeof(TestData));
    assertNotNull(data, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(TestData));

    data->notifier = parcNotifier_Create();
    data->notificationsToSend = 10;
    data->notificationsToRecieve = data->notificationsToSend;
    data->notificationsSent = 0;
    data->notificationsReceived = 0;
    data->barrier = 2;

    pthread_create(&data->consumerThread, NULL, consumer, data);
    pthread_create(&data->producerThread, NULL, producer, data);

    // wait for them to exit
    pthread_join(data->producerThread, NULL);
    pthread_join(data->consumerThread, NULL);

    assertTrue(data->notificationsReceived >= data->notificationsToRecieve,
               "Did not write all items got %u expected %u\n",
               data->notificationsReceived,
               data->notificationsToRecieve);

    parcNotifier_Release(&data->notifier);
    parcMemory_Deallocate((void **) &data);
}
开发者ID:PARC,项目名称:Libparc,代码行数:27,代码来源:test_parc_Notifier.c



注:本文中的parcMemory_Deallocate函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ parcel_w_string函数代码示例发布时间:2022-05-30
下一篇:
C++ parcBuffer_Release函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap