certi-cvs
[Top][All Lists]
Advanced

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

certi RTIA/FederationManagement.cc RTIG/Federat...


From: certi-cvs
Subject: certi RTIA/FederationManagement.cc RTIG/Federat...
Date: Wed, 13 Feb 2008 16:28:30 +0000

CVSROOT:        /sources/certi
Module name:    certi
Changes by:     ROUSSELOT <rousse>      08/02/13 16:28:30

Modified files:
        RTIA           : FederationManagement.cc 
        RTIG           : FederationsList.cc RTIG.cc RTIG_processing.cc 
        libCERTI       : Message.cc NetworkMessage.cc SocketServer.cc 
        test/Billard   : Billard.cc 

Log message:
        Bug #21335 correction. Destroy federation Execution allowed by non 
creator
        nor member.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/FederationManagement.cc?cvsroot=certi&r1=3.43&r2=3.44
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/FederationsList.cc?cvsroot=certi&r1=3.50&r2=3.51
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/RTIG.cc?cvsroot=certi&r1=3.33&r2=3.34
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/RTIG_processing.cc?cvsroot=certi&r1=3.50&r2=3.51
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/Message.cc?cvsroot=certi&r1=3.46&r2=3.47
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/NetworkMessage.cc?cvsroot=certi&r1=3.26&r2=3.27
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/SocketServer.cc?cvsroot=certi&r1=3.13&r2=3.14
http://cvs.savannah.gnu.org/viewcvs/certi/test/Billard/Billard.cc?cvsroot=certi&r1=3.27&r2=3.28

Patches:
Index: RTIA/FederationManagement.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/FederationManagement.cc,v
retrieving revision 3.43
retrieving revision 3.44
diff -u -b -r3.43 -r3.44
--- RTIA/FederationManagement.cc        12 Feb 2008 14:26:42 -0000      3.43
+++ RTIA/FederationManagement.cc        13 Feb 2008 16:28:29 -0000      3.44
@@ -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.43 2008/02/12 14:26:42 rousse Exp $
+// $Id: FederationManagement.cc,v 3.44 2008/02/13 16:28:29 rousse Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -77,6 +77,7 @@
 FederationManagement::~FederationManagement()
 {
     TypeException e ;
+    G.Out(pdGendoc,"enter ~FederationManagement");
 
     if (_est_membre_federation) {
         resignFederationExecution(RTI::DELETE_OBJECTS, e);
@@ -87,18 +88,20 @@
     // a-t-on avertit les autres federes de notre depart et donc
     // de la destruction de notre objet par RemoveObject(HARZI)
     // car le Remove Object ne diffuse pas le message
-    if (_est_createur_federation) {
-        cout << "RTIA: Staying active to destroy federation..." << endl ;
+    //if (_est_createur_federation) {
+    //    cout << "RTIA: Staying active to destroy federation..." << endl ;
 
-        destroyFederationExecution(_nom_federation, e);
-        while (e != e_NO_EXCEPTION) {
-                               sleep(1);
-            destroyFederationExecution(_nom_federation, e);
-        }
+     //  destroyFederationExecution(_nom_federation, e);
+      // while (e != e_NO_EXCEPTION) {
+       //                      sleep(1);
+          //  destroyFederationExecution(_nom_federation, e);
+       // }
         cout << "RTIA: Federation destroyed" << endl ;
-    }
+    //}
+
     delete _nom_federation ;
     delete _FEDid ;
+    G.Out(pdGendoc,"exit  ~FederationManagement");
 }
 
 // ----------------------------------------------------------------------------
@@ -204,13 +207,13 @@
     NetworkMessage requete, reponse ;
 
     D.Out(pdInit, "Destroy Federation %s.", theName);
-
+    G.Out(pdGendoc,"enter FederationManagement::destroyFederationExecution");
     e = e_NO_EXCEPTION ;
 
     // BUG: On devrait pouvoir detruire une federation meme si on n'est
     // pas le createur.
-    if (!_est_createur_federation || strcmp(theName, _nom_federation))
-        e = e_FederationExecutionDoesNotExist ;
+    //if (strcmp(theName, _nom_federation))
+    //    e = e_FederationExecutionDoesNotExist ;
 
     if (e == e_NO_EXCEPTION) {
         requete.type = NetworkMessage::DESTROY_FEDERATION_EXECUTION ;
@@ -219,7 +222,9 @@
         requete.federationName = new char[strlen(theName)+1] ;
         strcpy(requete.federationName, theName);
 
+        G.Out(pdGendoc,"destroyFederationExecution====>send Message to RTIG");
         comm->sendMessage(&requete);
+
         comm->waitMessage(&reponse,
                           NetworkMessage::DESTROY_FEDERATION_EXECUTION,
                           federate);
@@ -239,6 +244,7 @@
         else
             e = reponse.exception ;
     }
+G.Out(pdGendoc,"exit  FederationManagement::destroyFederationExecution");
 }
 
 // ----------------------------------------------------------------------------
@@ -996,4 +1002,4 @@
 
 }} // namespace certi/rtia
 
-// $Id: FederationManagement.cc,v 3.43 2008/02/12 14:26:42 rousse Exp $
+// $Id: FederationManagement.cc,v 3.44 2008/02/13 16:28:29 rousse Exp $

Index: RTIG/FederationsList.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/FederationsList.cc,v
retrieving revision 3.50
retrieving revision 3.51
diff -u -b -r3.50 -r3.51
--- RTIG/FederationsList.cc     1 Feb 2008 14:12:22 -0000       3.50
+++ RTIG/FederationsList.cc     13 Feb 2008 16:28:29 -0000      3.51
@@ -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.50 2008/02/01 14:12:22 rousse Exp $
+// $Id: FederationsList.cc,v 3.51 2008/02/13 16:28:29 rousse Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -306,14 +306,18 @@
                         Handle &handle)
     throw (FederationExecutionDoesNotExist, RTIinternalError)
 {
+    G.Out(pdGendoc,"enter FederationsList::exists");
+
     if (name == NULL) throw RTIinternalError("Null Federation Name.");
 
     for (list<Federation *>::iterator i = begin(); i != end(); i++) {
         if (!strcmp((*i)->getName(), name)) {
             handle = (*i)->getHandle();
+            G.Out(pdGendoc,"exit  FederationsList::exists");
             return ;
         }
     }
+    G.Out(pdGendoc,"exit  FederationsList::exists on exception");
 
     D.Out(pdDebug, "exists throws FederationExecutionDoesNotExist.");
     throw FederationExecutionDoesNotExist(name);
@@ -1526,5 +1530,5 @@
 
 }} // certi::rtig
 
-// EOF $Id: FederationsList.cc,v 3.50 2008/02/01 14:12:22 rousse Exp $
+// EOF $Id: FederationsList.cc,v 3.51 2008/02/13 16:28:29 rousse Exp $
 

Index: RTIG/RTIG.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/RTIG.cc,v
retrieving revision 3.33
retrieving revision 3.34
diff -u -b -r3.33 -r3.34
--- RTIG/RTIG.cc        12 Feb 2008 14:26:42 -0000      3.33
+++ RTIG/RTIG.cc        13 Feb 2008 16:28:30 -0000      3.34
@@ -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.33 2008/02/12 14:26:42 rousse Exp $
+// $Id: RTIG.cc,v 3.34 2008/02/13 16:28:30 rousse Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -86,6 +86,7 @@
 {
     G.Out(pdGendoc,"enter RTIG::chooseProcessingMethod");
     // This may throw a security error.
+    if ( msg->type != NetworkMessage::DESTROY_FEDERATION_EXECUTION)
     socketServer.checkMessage(link->returnSocket(), msg);
 
        //D.Mes(pdMessage, 'N', msg->type);
@@ -980,4 +981,4 @@
 
 }} // namespace certi/rtig
 
-// $Id: RTIG.cc,v 3.33 2008/02/12 14:26:42 rousse Exp $
+// $Id: RTIG.cc,v 3.34 2008/02/13 16:28:30 rousse Exp $

Index: RTIG/RTIG_processing.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/RTIG_processing.cc,v
retrieving revision 3.50
retrieving revision 3.51
diff -u -b -r3.50 -r3.51
--- RTIG/RTIG_processing.cc     12 Feb 2008 14:26:42 -0000      3.50
+++ RTIG/RTIG_processing.cc     13 Feb 2008 16:28:30 -0000      3.51
@@ -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.50 2008/02/12 14:26:42 rousse Exp $
+// $Id: RTIG_processing.cc,v 3.51 2008/02/13 16:28:30 rousse Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -316,8 +316,8 @@
     Handle num_federation ;
     char *federation = req->federationName ;
 
-    G.Out(pdGendoc,"BEGIN ** DESTROY FEDERATION SERVICE **");
     G.Out(pdGendoc,"enter RTIG::processDestroyFederation");
+    G.Out(pdGendoc,"BEGIN ** DESTROY FEDERATION SERVICE **");
 
     if (federation == NULL) throw RTIinternalError("Invalid Federation Name.");
 
@@ -334,13 +334,12 @@
     rep.federationName = new char[strlen(req->federationName)+1];
     strcpy(rep.federationName,req->federationName);
 
-    G.Out(pdGendoc,"processDestroyFederation===>write");
+    G.Out(pdGendoc,"processDestroyFederation===>write to RTIA");
 
     rep.write(link);
 
-    G.Out(pdGendoc,"exit RTIG::processDestroyFederation");
     G.Out(pdGendoc,"END ** DESTROY FEDERATION SERVICE **");
-
+    G.Out(pdGendoc,"exit RTIG::processDestroyFederation");
 }
 
 // ----------------------------------------------------------------------------
@@ -1345,4 +1344,4 @@
 
 }} // namespace certi/rtig
 
-// $Id: RTIG_processing.cc,v 3.50 2008/02/12 14:26:42 rousse Exp $
+// $Id: RTIG_processing.cc,v 3.51 2008/02/13 16:28:30 rousse Exp $

Index: libCERTI/Message.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/Message.cc,v
retrieving revision 3.46
retrieving revision 3.47
diff -u -b -r3.46 -r3.47
--- libCERTI/Message.cc 12 Feb 2008 14:26:43 -0000      3.46
+++ libCERTI/Message.cc 13 Feb 2008 16:28:30 -0000      3.47
@@ -644,16 +644,19 @@
       printf("CREATE_FEDERATION_EXECUTION : federationName %s : filename %s 
federateHandle %d \n",
              
((federationName==NULL)?"empty":federationName),((FEDid==NULL)?"empty":FEDid),federate)
 ;
     if ( type == DESTROY_FEDERATION_EXECUTION )
-      printf("DESTROY_FEDERATION_EXECUTION : federation %s : \n",
-             ((federationName==NULL)?"empty":federationName)) ;
+      printf("DESTROY_FEDERATION_EXECUTION : federation %s : federate %d\n",
+             ((federationName==NULL)?"empty":federationName),federate) ;
     else if ( type == JOIN_FEDERATION_EXECUTION )
       printf("JOIN_FEDERATION_EXECUTION : federate number %d federation name 
%s federate name %s\n",
              
federate,((federationName==NULL)?"empty":federationName),federateName) ;
     else
         printf(" type=%d :", type);
     printf(" date=%f: ", fed_time.getTime());
-    printf(" exception=%d: ", exception);
-    printf(" reason=%s: ",exceptionReason);
+    if (exception == 0 )
+        printf("NO_EXCEPTION ");
+    else
+        printf(" exception=%d: ",exception);
+    printf(" reason=%s: ",((exceptionReason==NULL)?"empty":exceptionReason));
     printf(" objectClass=%ld: ", objectClass);
     printf(" interactionClass=%ld:\n", interactionClass);
     printf(" attribute=%ld:\n", attribute);

Index: libCERTI/NetworkMessage.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/NetworkMessage.cc,v
retrieving revision 3.26
retrieving revision 3.27
diff -u -b -r3.26 -r3.27
--- libCERTI/NetworkMessage.cc  12 Feb 2008 14:26:43 -0000      3.26
+++ libCERTI/NetworkMessage.cc  13 Feb 2008 16:28:30 -0000      3.27
@@ -16,7 +16,7 @@
 // License along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: NetworkMessage.cc,v 3.26 2008/02/12 14:26:43 rousse Exp $
+// $Id: NetworkMessage.cc,v 3.27 2008/02/13 16:28:30 rousse Exp $
 // ----------------------------------------------------------------------------
 
 
@@ -40,6 +40,9 @@
     if ( type == CREATE_FEDERATION_EXECUTION )
         printf("CREATE_FEDERATION_EXECUTION : federationName %s : filename %s 
:"
                " federateHandle %d : federationHandle 
%d\n",federationName,FEDid,federate,federation);
+    if ( type == DESTROY_FEDERATION_EXECUTION )
+      printf("DESTROY_FEDERATION_EXECUTION : federationName %s : federate %d : 
federationHandle %d\n",
+             
((federationName==NULL)?"empty":federationName),federate,federation) ;
     else if (type == JOIN_FEDERATION_EXECUTION )
         printf("JOIN_FEDERATION_EXECUTION : federation %s : federate %s 
\n",federationName,federateName);
     else if (type == GET_FED_FILE ) 
@@ -49,7 +52,10 @@
         
     printf(" number = %ld-%d", federate, number);
     printf(" date = %f ", date);
-    printf(" exception = %d ", exception);
+    if (exception == 0 )
+        printf("NO_EXCEPTION ");
+    else
+        printf(" exception=%d: ",exception);
     printf(" ObjectHandle = %ld\n", objectClass);
     printf(" interactionClass= %ld\n", interactionClass);
     printf(" object = %ld\n", object);
@@ -355,4 +361,4 @@
 
 } // namespace certi
 
-// $Id: NetworkMessage.cc,v 3.26 2008/02/12 14:26:43 rousse Exp $
+// $Id: NetworkMessage.cc,v 3.27 2008/02/13 16:28:30 rousse Exp $

Index: libCERTI/SocketServer.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/SocketServer.cc,v
retrieving revision 3.13
retrieving revision 3.14
diff -u -b -r3.13 -r3.14
--- libCERTI/SocketServer.cc    12 Feb 2008 14:26:43 -0000      3.13
+++ libCERTI/SocketServer.cc    13 Feb 2008 16:28:30 -0000      3.14
@@ -19,7 +19,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 // USA
 //
-// $Id: SocketServer.cc,v 3.13 2008/02/12 14:26:43 rousse Exp $
+// $Id: SocketServer.cc,v 3.14 2008/02/13 16:28:30 rousse Exp $
 // ----------------------------------------------------------------------------
 
 
@@ -62,6 +62,7 @@
     throw (SecurityError)
 {
     G.Out(pdGendoc,"enter SocketServer::checkMessage");
+
     if ((message->federation == 0) && (message->federate == 0))
         {
         G.Out(pdGendoc,"exit  SocketServer::checkMessage on return");
@@ -221,6 +222,7 @@
                             TransportType the_type) const
     throw (FederateNotExecutionMember, RTIinternalError)
 {
+    G.Out(pdGendoc,"enter SocketServer::getSocketLink");
     // It may throw FederateNotExecutionMember
     SocketTuple *tuple = getWithReferences(the_federation, the_federate);
 
@@ -234,6 +236,7 @@
             throw RTIinternalError("Reference to a killed Federate.");
         return tuple->BestEffortLink ;
     }
+    G.Out(pdGendoc,"exit  SocketServer::getSocketLink without return");
 }
 
 // ----------------------------------------------------------------------------
@@ -326,4 +329,4 @@
 
 }
 
-// $Id: SocketServer.cc,v 3.13 2008/02/12 14:26:43 rousse Exp $
+// $Id: SocketServer.cc,v 3.14 2008/02/13 16:28:30 rousse Exp $

Index: test/Billard/Billard.cc
===================================================================
RCS file: /sources/certi/certi/test/Billard/Billard.cc,v
retrieving revision 3.27
retrieving revision 3.28
diff -u -b -r3.27 -r3.28
--- test/Billard/Billard.cc     15 Nov 2007 10:09:15 -0000      3.27
+++ test/Billard/Billard.cc     13 Feb 2008 16:28:30 -0000      3.28
@@ -407,6 +407,9 @@
 Billard::declare()
 {
     local.ID = registerBallInstance(federateName.c_str());
+   // test, quelle est la classe de l'objet cree
+   cout << "the class of the new created object is" <<
+rtiamb.getObjectClass (local.ID) << endl ;
 }
 
 // ----------------------------------------------------------------------------




reply via email to

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