certi-cvs
[Top][All Lists]
Advanced

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

[certi-cvs] certi RTIA/FederationManagement.cc RTIA/RTIA.cc...


From: certi-cvs
Subject: [certi-cvs] certi RTIA/FederationManagement.cc RTIA/RTIA.cc...
Date: Tue, 01 Apr 2008 13:00:47 +0000

CVSROOT:        /sources/certi
Module name:    certi
Changes by:     ROUSSELOT <rousse>      08/04/01 13:00:47

Modified files:
        RTIA           : FederationManagement.cc RTIA.cc 
                         RTIA_federate.cc 
        RTIG           : Federation.cc FederationsList.cc RTIG.cc 
                         RTIG_processing.cc 
        libRTI         : RTIambassador.cc 

Log message:
        Improvment of exceptions return to application along destroy federation

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/FederationManagement.cc?cvsroot=certi&r1=3.51&r2=3.52
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/RTIA.cc?cvsroot=certi&r1=3.15&r2=3.16
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/RTIA_federate.cc?cvsroot=certi&r1=3.69&r2=3.70
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/Federation.cc?cvsroot=certi&r1=3.80&r2=3.81
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/FederationsList.cc?cvsroot=certi&r1=3.54&r2=3.55
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/RTIG.cc?cvsroot=certi&r1=3.36&r2=3.37
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/RTIG_processing.cc?cvsroot=certi&r1=3.57&r2=3.58
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTIambassador.cc?cvsroot=certi&r1=3.73&r2=3.74

Patches:
Index: RTIA/FederationManagement.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/FederationManagement.cc,v
retrieving revision 3.51
retrieving revision 3.52
diff -u -b -r3.51 -r3.52
--- RTIA/FederationManagement.cc        14 Mar 2008 14:52:23 -0000      3.51
+++ RTIA/FederationManagement.cc        1 Apr 2008 13:00:46 -0000       3.52
@@ -18,7 +18,7 @@
 // along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: FederationManagement.cc,v 3.51 2008/03/14 14:52:23 rousse Exp $
+// $Id: FederationManagement.cc,v 3.52 2008/04/01 13:00:46 rousse Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -243,14 +243,18 @@
                {
                if ( _FEDid[0] != '\0' )
                    {
+                   std::cout<<"Removing temporary file "<<_FEDid<<" on destroy 
federation."<<std::endl;
                    std::remove(_FEDid);
                    _FEDid[0] = '\0' ;
                    }
                }
             }
         else
+            {
+            // There is an exception so destroy may be not done on RTIG
             e = reponse.exception ;
     }
+    }
 
 G.Out(pdGendoc,"exit  FederationManagement::destroyFederationExecution");
 }
@@ -475,6 +479,7 @@
             {
             if ( _FEDid[0] != '\0' )
                 {
+                std::cout<<"Removing temporary file "<<_FEDid<<" on resign 
federation."<<std::endl;
                 std::remove(_FEDid);
                 _FEDid[0] = '\0' ;
                 }
@@ -1025,4 +1030,4 @@
 
 }} // namespace certi/rtia
 
-// $Id: FederationManagement.cc,v 3.51 2008/03/14 14:52:23 rousse Exp $
+// $Id: FederationManagement.cc,v 3.52 2008/04/01 13:00:46 rousse Exp $

Index: RTIA/RTIA.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/RTIA.cc,v
retrieving revision 3.15
retrieving revision 3.16
diff -u -b -r3.15 -r3.16
--- RTIA/RTIA.cc        14 Mar 2008 14:52:23 -0000      3.15
+++ RTIA/RTIA.cc        1 Apr 2008 13:00:46 -0000       3.16
@@ -18,7 +18,7 @@
 // along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: RTIA.cc,v 3.15 2008/03/14 14:52:23 rousse Exp $
+// $Id: RTIA.cc,v 3.16 2008/04/01 13:00:46 rousse Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -67,7 +67,17 @@
         {
         if ( fm->_FEDid[0] != '\0' )
            {
+           // If RTIA end (abort ?) before join don't remove file if not 
temporary
+           // temporary file name begins with _RT ( yes, but...)
+           if ( fm->_FEDid[0] != '_' || fm->_FEDid[1] != 'R' || fm->_FEDid[2] 
!= 'T')
+              {
+               std::cout<<"** W ** I don't remove file 
"<<fm->_FEDid<<std::endl;
+              }
+           else
+              {
+              std::cout<<"*** W ** Removing temporary file "<<fm->_FEDid<<" on 
RTIA stop."<<std::endl;
            std::remove(fm->_FEDid);
+              }
            fm->_FEDid[0] = '\0' ;
            }
         }
@@ -170,4 +180,4 @@
 
 }} // namespace certi/rtia
 
-// $Id: RTIA.cc,v 3.15 2008/03/14 14:52:23 rousse Exp $
+// $Id: RTIA.cc,v 3.16 2008/04/01 13:00:46 rousse Exp $

Index: RTIA/RTIA_federate.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/RTIA_federate.cc,v
retrieving revision 3.69
retrieving revision 3.70
diff -u -b -r3.69 -r3.70
--- RTIA/RTIA_federate.cc       14 Mar 2008 14:52:23 -0000      3.69
+++ RTIA/RTIA_federate.cc       1 Apr 2008 13:00:46 -0000       3.70
@@ -18,7 +18,7 @@
 // along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: RTIA_federate.cc,v 3.69 2008/03/14 14:52:23 rousse Exp $
+// $Id: RTIA_federate.cc,v 3.70 2008/04/01 13:00:46 rousse Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -128,6 +128,10 @@
               "Receiving Message from Federate, type DestroyFederation.");
 
         fm->destroyFederationExecution(req->getFederationName(), e);
+        if ( e == e_RTIinternalError )
+            {
+            rep.setException(e,"Illegal federation handle");
+            }
         // RTIA needs federation name into the answer (rep Message) to federate
         rep.setFederationName(req->getFederationName());
         break ;
@@ -1328,4 +1332,4 @@
 
 }} // namespace certi/rtia
 
-// $Id: RTIA_federate.cc,v 3.69 2008/03/14 14:52:23 rousse Exp $
+// $Id: RTIA_federate.cc,v 3.70 2008/04/01 13:00:46 rousse Exp $

Index: RTIG/Federation.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/Federation.cc,v
retrieving revision 3.80
retrieving revision 3.81
diff -u -b -r3.80 -r3.81
--- RTIG/Federation.cc  5 Mar 2008 15:33:50 -0000       3.80
+++ RTIG/Federation.cc  1 Apr 2008 13:00:46 -0000       3.81
@@ -18,7 +18,7 @@
 // along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: Federation.cc,v 3.80 2008/03/05 15:33:50 rousse Exp $
+// $Id: Federation.cc,v 3.81 2008/04/01 13:00:46 rousse Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -2292,6 +2292,9 @@
         mess.handleArray[i] = theAttributeList[i] ;
         }
 
+     G.Out(pdGendoc,"            requestObjectOwner ===> write PAVU to RTIA %d"
+                   ,theOwnerHandle);
+
      mess.write(server->getSocketLink(theOwnerHandle));
  
    
@@ -2302,5 +2305,5 @@
 
 }} // namespace certi/rtig
 
-// $Id: Federation.cc,v 3.80 2008/03/05 15:33:50 rousse Exp $
+// $Id: Federation.cc,v 3.81 2008/04/01 13:00:46 rousse Exp $
 

Index: RTIG/FederationsList.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/FederationsList.cc,v
retrieving revision 3.54
retrieving revision 3.55
diff -u -b -r3.54 -r3.55
--- RTIG/FederationsList.cc     14 Mar 2008 14:52:24 -0000      3.54
+++ RTIG/FederationsList.cc     1 Apr 2008 13:00:47 -0000       3.55
@@ -18,7 +18,7 @@
 // along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: FederationsList.cc,v 3.54 2008/03/14 14:52:24 rousse Exp $
+// $Id: FederationsList.cc,v 3.55 2008/04/01 13:00:47 rousse Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -846,19 +846,19 @@
            RTIinternalError)
 {
     Federation *federation ;
+    list<Federation *>::iterator i ;
 
     G.Out(pdGendoc,"enter FederationsList::destroyFederation");
 
-    // It may throw RTIinternalError
-    checkHandle(handle);
+    // It may throw :
+    // RTIinternalError during checkHandle
+    // FederationExecutionDoesNotExist during search federation
+    searchFederation(handle, federation);
 
-    // It may throw FederationExecutionDoesNotExist
-    int rank = searchFederation(handle, federation);
-    // It may throw FederatesCurrentlyJoined
+    // It may throw FederatesCurrentlyJoined if federation not empty (in empty)
     if (federation->empty()) {
-        list<Federation *>::iterator i = begin();
-        for (int j = 1 ; i != end() && j <= rank ; j++, i++) {
-            if (j == rank) {
+        for (i = begin() ; i != end() ; i++) {
+            if ((*i)->getHandle() == handle ) {
                                        // FIXME EN:comment utiliser 
erase(iterator) dans une boucle.
                 i=erase(i);
                 break;
@@ -866,7 +866,6 @@
         }
         delete federation ;
     }
-
     G.Out(pdGendoc,"exit FederationsList::destroyFederation");
 }
 
@@ -1560,5 +1559,5 @@
 
 }} // certi::rtig
 
-// EOF $Id: FederationsList.cc,v 3.54 2008/03/14 14:52:24 rousse Exp $
+// EOF $Id: FederationsList.cc,v 3.55 2008/04/01 13:00:47 rousse Exp $
 

Index: RTIG/RTIG.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/RTIG.cc,v
retrieving revision 3.36
retrieving revision 3.37
diff -u -b -r3.36 -r3.37
--- RTIG/RTIG.cc        7 Mar 2008 16:10:06 -0000       3.36
+++ RTIG/RTIG.cc        1 Apr 2008 13:00:47 -0000       3.37
@@ -18,7 +18,7 @@
 // along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: RTIG.cc,v 3.36 2008/03/07 16:10:06 rousse Exp $
+// $Id: RTIG.cc,v 3.37 2008/04/01 13:00:47 rousse Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -963,6 +963,7 @@
     if (link == NULL) return link ;
 
     if (rep.exception != e_NO_EXCEPTION) {
+        G.Out(pdGendoc,"            processIncomingMessage ===> write on 
exception to RTIA");
         rep.write(link);
         D.Out(pdExcept,
               "RTIG catched exception %d and sent it back to federate %d.",
@@ -987,4 +988,4 @@
 
 }} // namespace certi/rtig
 
-// $Id: RTIG.cc,v 3.36 2008/03/07 16:10:06 rousse Exp $
+// $Id: RTIG.cc,v 3.37 2008/04/01 13:00:47 rousse Exp $

Index: RTIG/RTIG_processing.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/RTIG_processing.cc,v
retrieving revision 3.57
retrieving revision 3.58
diff -u -b -r3.57 -r3.58
--- RTIG/RTIG_processing.cc     14 Mar 2008 14:52:24 -0000      3.57
+++ RTIG/RTIG_processing.cc     1 Apr 2008 13:00:47 -0000       3.58
@@ -18,7 +18,7 @@
 // along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: RTIG_processing.cc,v 3.57 2008/03/14 14:52:24 rousse Exp $
+// $Id: RTIG_processing.cc,v 3.58 2008/04/01 13:00:47 rousse Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -344,28 +344,54 @@
 void
 RTIG::processDestroyFederation(Socket *link, NetworkMessage *req)
 {
+    NetworkMessage rep ;
     Handle num_federation ;
+
     char *federation = req->federationName ;
 
     G.Out(pdGendoc,"enter RTIG::processDestroyFederation");
     G.Out(pdGendoc,"BEGIN ** DESTROY FEDERATION SERVICE **");
 
+    rep.exception = e_NO_EXCEPTION ;
+
     if (federation == NULL) throw RTIinternalError("Invalid Federation Name.");
 
     auditServer << "Name \"" << federation << "\"" ;
     federations.exists(federation, num_federation);
+    // May throw RTIinternalError
+    //           FederatesCurrentlyJoined
+    //           FederationExecutionDoesNotExist
+    try
+      {
     federations.destroyFederation(num_federation);
     federationHandles.free(num_federation);
     D.Out(pdInit, "Federation \"%s\" has been destroyed.", federation);
+      }
+    catch (RTI::Exception &e)
+      { printf("ERROR : %s  reason : %s\n",e._name,e._reason);
+        if (strcmp(e._name,"RTIinternalError")==0 )
+          {
+          rep.exception = e_RTIinternalError;
+          strcpy(rep.exceptionReason,e._reason);
+          } 
+        else if (strcmp(e._name,"FederationExecutionDoesNotExist")==0 )
+          {
+          rep.exception = e_FederationExecutionDoesNotExist;
+          strcpy(rep.exceptionReason,e._reason);
+          }
+        else if (strcmp(e._name,"FederatesCurrentlyJoined")==0 )
+          {
+          rep.exception = e_FederatesCurrentlyJoined;
+          strcpy(rep.exceptionReason,e._reason);
+          }       
+      }
 
-    NetworkMessage rep ;
     rep.type = NetworkMessage::DESTROY_FEDERATION_EXECUTION ;
-    rep.exception = e_NO_EXCEPTION ;
     rep.federate = req->federate ;
     rep.federationName = new char[strlen(req->federationName)+1];
     strcpy(rep.federationName,req->federationName);
 
-    G.Out(pdGendoc,"processDestroyFederation===>write to RTIA");
+    G.Out(pdGendoc,"processDestroyFederation===>write DFE to RTIA");
 
     rep.write(link);
 
@@ -1435,4 +1461,4 @@
 
 }} // namespace certi/rtig
 
-// $Id: RTIG_processing.cc,v 3.57 2008/03/14 14:52:24 rousse Exp $
+// $Id: RTIG_processing.cc,v 3.58 2008/04/01 13:00:47 rousse Exp $

Index: libRTI/RTIambassador.cc
===================================================================
RCS file: /sources/certi/certi/libRTI/RTIambassador.cc,v
retrieving revision 3.73
retrieving revision 3.74
diff -u -b -r3.73 -r3.74
--- libRTI/RTIambassador.cc     13 Mar 2008 14:39:19 -0000      3.73
+++ libRTI/RTIambassador.cc     1 Apr 2008 13:00:47 -0000       3.74
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: RTIambassador.cc,v 3.73 2008/03/13 14:39:19 siron Exp $
+// $Id: RTIambassador.cc,v 3.74 2008/04/01 13:00:47 rousse Exp $
 // ----------------------------------------------------------------------------
 
 
@@ -2420,9 +2420,15 @@
            RTIinternalError)
 {
     Message req, rep ;
+
+    G.Out(pdGendoc,"enter RTIambassador::getObjectClassHandle");
+
     req.type = Message::GET_OBJECT_CLASS_HANDLE ;
     req.setName(theName);
     privateRefs->executeService(&req, &rep);
+
+    G.Out(pdGendoc,"exit RTIambassador::getObjectClassHandle");
+
     return rep.getObjectClass();
 }
 
@@ -2909,4 +2915,4 @@
     privateRefs->executeService(&req, &rep);
 }
 
-// $Id: RTIambassador.cc,v 3.73 2008/03/13 14:39:19 siron Exp $
+// $Id: RTIambassador.cc,v 3.74 2008/04/01 13:00:47 rousse Exp $




reply via email to

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