certi-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [certi-dev] Bug fixing


From: Eric Noulard
Subject: Re: [certi-dev] Bug fixing
Date: Wed, 16 Dec 2009 08:36:59 +0100

Hi Yaomin,

Thank you for your feedback.
I'll try to give you an update on this in 2-3 days I'm kind of busy just now.
(anyone wanting to take over during this is time is welcome :-)

2009/12/16 Yaomin Fu <address@hidden>:
> Hi Erk,
>
> Following is the fixing for multiple "Register Federation Synchronization 
> Point"
>
> Besides, it is found that at the federate join federation time, the registered
> synchronization points are announced to the calling federate, which is not
> specified in either ISIO 1.3 or IEEE 1516. It is suggested to comment out the
> message in the processingJoinFederation method.
>
> ========================================================================
> Both ISIO 1.3 and IEEE 1516 specify that multiple registering should not have
> consequence to the federation execution, but have to tell the reason.
> The reason can only be local to ritg because there is no network message 
> defined
> for rtig to use for this failure.
> What rtig can do is add the synchronization point to the calling federate if 
> it
> is in the federation, and announce it back to the calling federate only.
>
> 1. Federation to rewrite the first overload method to pass the call to the
> second with 5 parameters.
> void
>  Federation::registerSynchronization(FederateHandle federate,
>  const char *label,
>  const char *tag)
>
>     throw (FederateNotExecutionMember,
>           FederationAlreadyPaused,
>  SaveInProgress, RestoreInProgress,
>  RTIinternalError)
>
> {
>
>     unsigned short count;
>
>     std::vector <FederateHandle> federate_set;
>
>     for (count = 0; count < federates.size(); count ++)
> federate_set.push_back(federates[count].getHandle());
>
>
>     registerSynchronization(federate, label, tag, count, federate_set);
> }
>
> 2. Federation to modify the second overload method to add the label to the
> calling federate and raise the exception
> void
> Federation::registerSynchronization(FederateHandle federate,
>  const char *label,
>  const char *tag, unsigned short federate_setSize,
>  std::vector <FederateHandle> &federate_set)
>     throw (FederateNotExecutionMember, FederationAlreadyPaused, 
> SaveInProgress,
> RestoreInProgress, RTIinternalError)
>
> {
>
>     G.Out(pdGendoc,"enter Federation::registerSynchronization");
>
>     this->check(federate); // It may throw FederateNotExecutionMember.
>
>     if (label == NULL) throw RTIinternalError("Bad pause label(null).");
>
>
>
>     // Check whether the federate has joined the federation
>
>     bool bInFederation = false;
>     for (unsigned int i = 0; i < federates.size(); i ++)
>     {
>         if (federate == federates[i].getHandle())
>         {
>
>             bInFederation = true;
>             break;
>
>         }
>
>     }
>
>
>     if (!bInFederation) throw FederateNotExecutionMember("Federate is not in
> federation");
>
>     // Verify label does not already exists
>
>     bool bPendingLabel = false;
>     std::map<const char *, const char *>::const_iterator i;
>
>     i = synchronizationLabels.begin();
>     for (; i != synchronizationLabels.end(); i++) {
>         if (!strcmp((*i).first, label)) {
>             bPendingLabel = true;
>             break;
>         }
>
>     }
>
>
>     // If not already in pending labels, insert to list.
>
>     if (!bPendingLabel) synchronizationLabels.insert(pair<const char *, const
> char *>(strdup(label), strdup(tag)));
>
>     // Add label to each federate into the set only (may throw
> RTIinternalError).
>     FederateList::iterator j ;
>
>     for (int i=0 ; i < federate_setSize  ;i++ ) {
>         for (j = federates.begin(); j != federates.end(); ++j) {
>             if ( (federate_set[i] == j->getHandle()) || (federate ==
> j->getHandle()) ) {
>                if (!j->isSynchronizationLabel(label))
> j->addSynchronizationLabel(label);
>             }
>         }
>     }
>
>     D[pdTerm] << "Federation " << handle << " is now synchronizing for label "
>  << label << endl ;
>
>     G.Out(pdGendoc,"exit  Federation::registerSynchronization");
>
>
>
>     if (bPendingLabel) throw FederationAlreadyPaused("Label already pending");
> }
>
> 3. RTIG to modify processRegisterSynchronization() method to process the
> exception and annoce the registration back to the calling federate
> void
> RTIG::processRegisterSynchronization(Socket *link,
> NM_Register_Federation_Synchronization_Point *req)
> {
>     G.Out(pdGendoc,"BEGIN ** REGISTER FEDERATION SYNCHRONIZATION POINT Service
> **");
>     G.Out(pdGendoc,"enter RTIG::processRegisterSynchronization");
>
>     auditServer << "Label \"" << req->getLabel().c_str() << "\" registered. 
> Tag
> is \""
>
>                 << req->getTag().c_str() << "\"" ;
>
>
>
>     try {
>     // boolean true means a federates set exists
>     if ( req->doesSetExist() )
>        federations.manageSynchronization(req->federation, req->federate, true,
> req->getLabel().c_str(), req->getTag().c_str(), req->handleArraySize,
> req->handleArray);
>     else
>
>        federations.manageSynchronization(req->federation, req->federate, true,
> req->getLabel().c_str(),
>  req->getTag().c_str());
>
>     D.Out(pdTerm, "Federation %u is now synchronizing.", req->federation);
>
>     // send synchronizationPointRegistrationSucceeded() to federate.
>
>     NM_Synchronization_Point_Registration_Succeeded rep ;
>     rep.federate = req->federate ;
>     rep.federation = req->federation ;
>
>     rep.setLabel(req->getLabel().c_str());
>     G.Out(pdGendoc,"      processRegisterSynchronization====> write SPRS to
> RTIA");
>
>
>     rep.send(link,NM_msgBufSend);
>
>     }
>     catch (FederateNotExecutionMember& e)
>
>     {
>
>     // don't know how to process
>
>     }
>     catch (FederationAlreadyPaused& e)
>     {
>     std::vector<FederateHandle> federate_set;
>
>     federate_set.push_back(req->federate);
>
>     federations.broadcastSynchronization(req->federation, req->federate,
> req->getLabel().c_str(), req->getTag().c_str(), 1,
>  federate_set);
>     return;
>     }
>
>
>
>     // boolean true means a federates set exists
>     if ( req->doesSetExist() )
>        federations.broadcastSynchronization(req->federation,
>  req->federate, req->getLabel().c_str(), req->getTag().c_str(),
> req->handleArraySize, req->handleArray);
>     else
>        federations.broadcastSynchronization(req->federation,
>  req->federate, req->getLabel().c_str(), req->getTag().c_str());
>
>     G.Out(pdGendoc,"exit  RTIG::processRegisterSynchronization");
>     G.Out(pdGendoc,"END   ** REGISTER FEDERATION SYNCHRONIZATION POINT Service
> **");
>
>
> }
>
>
>
> --
> CERTI-Devel mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/certi-devel
>



-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]