- /*
+/*
* $Id: objectEntryTimer.c,v 0.0.0.1 2003/09/10
*
* DEBUG: section 12 Timer function on object from eventEntry
- * AUTHOR: Petr Smolik petr.smolik@wo.cz
*
- * ORTE - OCERA Real-Time Ethernet http://www.ocera.org/
+ * -------------------------------------------------------------------
+ * ORTE
+ * Open Real-Time Ethernet
+ *
+ * Copyright (C) 2001-2006
+ * Department of Control Engineering FEE CTU Prague, Czech Republic
+ * http://dce.felk.cvut.cz
+ * http://www.ocera.org
+ *
+ * Author: Petr Smolik petr@smoliku.cz
+ * Advisor: Pavel Pisa
+ * Project Responsible: Zdenek Hanzalek
* --------------------------------------------------------------------
*
* This program is free software; you can redistribute it and/or modify
*
*/
-#include "orte.h"
+#include "orte_all.h"
/*****************************************************************************/
int
objectEntryOID->objectEntryHID->hid,
objectEntryOID->objectEntryAID->aid,
objectEntryOID->oid);
- objectEntryDelete(d,objectEntryOID);
+ objectEntryDelete(d,objectEntryOID,ORTE_TRUE);
objectEntryDump(&d->objectEntry);
debug(12,10) ("objectEntryPurgeTimer: finished\n");
if (!robjectEntryOID) return;
if (!gavl_cmp_guid(&robjectEntryOID->guid,&d->guid)) return;
- debug(12,3) ("application removed\n");
+ debug(12,3) ("application removed - AID: 0%x\n",robjectEntryOID->guid.aid);
guid=robjectEntryOID->guid;
//publication, subsription and application
removePublicationsOnLocalSubscriptions(d,robjectEntryOID);
removeSubscriptionsOnLocalPublications(d,robjectEntryOID);
//destroy all object - the object will be disconneced in objectEntryDelete
- while((objectEntryOID=ObjectEntryOID_first(robjectEntryOID->objectEntryAID))) {
- switch (objectEntryOID->oid & 0x07) {
+ objectEntryOID=ObjectEntryOID_first(robjectEntryOID->objectEntryAID);
+ while (objectEntryOID) {
+ ObjectEntryOID *objectEntryOID_delete=objectEntryOID;
+ objectEntryOID=ObjectEntryOID_next(robjectEntryOID->objectEntryAID,objectEntryOID);
+ switch (objectEntryOID_delete->oid & 0x07) {
case OID_PUBLICATION:
pthread_rwlock_wrlock(&d->psEntry.publicationsLock);
- PublicationList_delete(&d->psEntry,objectEntryOID);
+ PublicationList_delete(&d->psEntry,objectEntryOID_delete);
pthread_rwlock_unlock(&d->psEntry.publicationsLock);
break;
case OID_SUBSCRIPTION:
pthread_rwlock_wrlock(&d->psEntry.subscriptionsLock);
- SubscriptionList_delete(&d->psEntry,objectEntryOID);
+ SubscriptionList_delete(&d->psEntry,objectEntryOID_delete);
pthread_rwlock_unlock(&d->psEntry.subscriptionsLock);
break;
}
- if (objectEntryDelete(d,objectEntryOID)>1) //AID was deleted
- break;
+ objectEntryDelete(d,objectEntryOID_delete,ORTE_TRUE);
}
}
break; //yes
}
if (!objectEntryAID) { //not exists
- gavl_cust_for_each(ObjectEntryAID,
- robjectEntryOID->objectEntryHID,objectEntryAID) {
- if ((objectEntryAID->aid & 0x03) == MANAGEDAPPLICATION) {
+ objectEntryAID=ObjectEntryAID_first(robjectEntryOID->objectEntryHID);
+ while (objectEntryAID) {
+ ObjectEntryAID *objectEntryAID_delete=objectEntryAID;
+ objectEntryAID=ObjectEntryAID_next(robjectEntryOID->objectEntryHID,objectEntryAID);
+ if ((objectEntryAID_delete->aid & 0x03) == MANAGEDAPPLICATION) {
ObjectEntryOID *objectEntryOID;
- objectEntryOID=ObjectEntryOID_find(objectEntryAID,&guid.oid);
+ objectEntryOID=ObjectEntryOID_find(objectEntryAID_delete,&guid.oid);
if (gavl_cmp_guid(&objectEntryOID->guid,&d->guid)) { //!=
removeApplication(d,objectEntryOID);
- objectEntryAID= //start
- ObjectEntryAID_first(robjectEntryOID->objectEntryHID);
}
}
}
CSTReaderDestroyRemoteWriter(d,cstRemoteWriter);
pthread_rwlock_unlock(&d->readerApplications.lock);
pthread_rwlock_unlock(&d->readerManagers.lock);
- objectEntryDelete(d,robjectEntryOID);
+ objectEntryDelete(d,robjectEntryOID,ORTE_TRUE);
}
CSChangeAttributes_init_head(csChange);
csChange->guid=guid;
csChange->alive=ORTE_FALSE;
- csChange->cdrStream.buffer=NULL;
+ csChange->cdrCodec.buffer=NULL;
CSTWriterAddCSChange(d,&d->writerManagers,csChange);
gavl_cust_for_each(ObjectEntryAID,
objectEntryOID->objectEntryHID,objectEntryAID) {
parameterUpdateCSChange(csChange,d->appParams,ORTE_TRUE);
csChange->guid=guid;
csChange->alive=ORTE_FALSE;
- csChange->cdrStream.buffer=NULL;
+ csChange->cdrCodec.buffer=NULL;
CSTWriterAddCSChange(d,&d->writerApplications,csChange);
//increment vargAppsSequenceNumber and make csChange
SeqNumberInc(d->appParams->vargAppsSequenceNumber,
d->appParams->vargAppsSequenceNumber);
appSelfParamChanged(d,ORTE_FALSE,ORTE_FALSE,ORTE_TRUE,ORTE_TRUE);
} else {
- objectEntryDelete(d,objectEntryOID);
+ objectEntryDelete(d,objectEntryOID,ORTE_TRUE);
objectEntryOID=NULL;
}
pthread_rwlock_unlock(&d->writerApplicationSelf.lock);
pthread_rwlock_wrlock(&d->psEntry.publicationsLock);
PublicationList_delete(&d->psEntry,objectEntryOID);
pthread_rwlock_unlock(&d->psEntry.publicationsLock);
- if (!objectEntryOID->private) { //not local object cann't be purged
- objectEntryDelete(d,objectEntryOID);
+ if (!objectEntryOID->privateCreated) { //not local object cann't be purged
+ objectEntryDelete(d,objectEntryOID,ORTE_TRUE);
objectEntryOID=NULL;
}
break;
pthread_rwlock_wrlock(&d->psEntry.subscriptionsLock);
SubscriptionList_delete(&d->psEntry,objectEntryOID);
pthread_rwlock_unlock(&d->psEntry.subscriptionsLock);
- if (!objectEntryOID->private) { //local object cann't be purged immediately
- objectEntryDelete(d,objectEntryOID);
+ if (!objectEntryOID->privateCreated) { //local object cann't be purged immediately
+ objectEntryDelete(d,objectEntryOID,ORTE_TRUE);
objectEntryOID=NULL;
}
break;
NULL,
objectEntryOID,
&d->domainProp.baseProp.purgeTime);
- debug(12,3) ("expired: 0x%x-0x%x-0x%x marked for remove\n",
+ debug(12,3) ("expired: 0x%x-0x%x-0x%x marked for remove(%ds)\n",
objectEntryOID->objectEntryHID->hid,
objectEntryOID->objectEntryAID->aid,
- objectEntryOID->oid);
+ objectEntryOID->oid,
+ d->domainProp.baseProp.purgeTime.seconds);
}
objectEntryDump(&d->objectEntry);
+ debug(12,3) ("expired: finished\n");
if (!objectEntryOID) return 2;
return 0;
}