// Release of the reference counter UINT Release(REF *ref) { UINT c; // Validate arguments if (ref == NULL) { return 0; } // KS KS_INC(KS_RELEASE_COUNT); KS_DEC(KS_CURRENT_REFED_COUNT); c = Dec(ref->c); if (c == 0) { // KS KS_DEC(KS_CURRENT_REF_COUNT); KS_INC(KS_FREEREF_COUNT); DeleteCounter(ref->c); ref->c = 0; Free(ref); } return c; }
// Clean up Cedar void CleanupCedar(CEDAR *c) { UINT i; // Validate arguments if (c == NULL) { return; } WuFreeWebUI(c->WebUI); FreeCedarLayer3(c); /* for (i = 0;i < LIST_NUM(c->HubList);i++) { HUB *h = LIST_DATA(c->HubList, i); } */ for (i = 0;i < LIST_NUM(c->CaList);i++) { X *x = LIST_DATA(c->CaList, i); FreeX(x); } ReleaseList(c->CaList); ReleaseList(c->ListenerList); ReleaseList(c->HubList); ReleaseList(c->ConnectionList); //CleanupUDPEntry(c); ReleaseList(c->UDPEntryList); DeleteLock(c->lock); DeleteCounter(c->ConnectionIncrement); DeleteCounter(c->CurrentSessions); if (c->DebugLog != NULL) { FreeLog(c->DebugLog); } if (c->ServerX) { FreeX(c->ServerX); } if (c->ServerK) { FreeK(c->ServerK); } if (c->CipherList) { Free(c->CipherList); } for (i = 0;i < LIST_NUM(c->TrafficDiffList);i++) { TRAFFIC_DIFF *d = LIST_DATA(c->TrafficDiffList, i); Free(d->Name); Free(d->HubName); Free(d); } ReleaseList(c->TrafficDiffList); Free(c->ServerStr); Free(c->MachineName); Free(c->HttpUserAgent); Free(c->HttpAccept); Free(c->HttpAcceptLanguage); Free(c->HttpAcceptEncoding); FreeTraffic(c->Traffic); DeleteLock(c->TrafficLock); FreeNetSvcList(c); Free(c->VerString); Free(c->BuildInfo); FreeLocalBridgeList(c); DeleteCounter(c->AssignedBridgeLicense); DeleteCounter(c->AssignedClientLicense); FreeNoSslList(c); DeleteLock(c->CedarSuperLock); DeleteCounter(c->AcceptingSockets); ReleaseIntList(c->UdpPortList); DeleteLock(c->OpenVPNPublicPortsLock); DeleteLock(c->CurrentRegionLock); DeleteLock(c->CurrentTcpQueueSizeLock); DeleteLock(c->QueueBudgetLock); DeleteLock(c->FifoBudgetLock); DeleteCounter(c->CurrentActiveLinks); Free(c); }
/** * Delete the resources associated with this counter. * The resources including the underlying object are deleted for this counter. * @param channel The channel of the digital input used with this counter */ void DeleteCounter(UINT32 channel) { DeleteCounter(SensorBase::GetDefaultDigitalModule(), channel); }