certi-cvs
[Top][All Lists]
Advanced

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

[certi-cvs] certi/RTIA RTIA.cc RTIA_federate.cc FederationM...


From: certi-cvs
Subject: [certi-cvs] certi/RTIA RTIA.cc RTIA_federate.cc FederationM...
Date: Mon, 21 Sep 2009 15:42:11 +0000

CVSROOT:        /sources/certi
Module name:    certi
Changes by:     Eric NOULARD <erk>      09/09/21 15:42:11

Modified files:
        RTIA           : RTIA.cc RTIA_federate.cc 
                         FederationManagement.cc RTIA.hh 

Log message:
        Merge in
        patch #6923: Avoid crash on close conection if the federation is 
destroyed
        from Mathias.
        Additionnal comment and code pruning from me (Erk).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/RTIA.cc?cvsroot=certi&r1=3.26&r2=3.27
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/RTIA_federate.cc?cvsroot=certi&r1=3.96&r2=3.97
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/FederationManagement.cc?cvsroot=certi&r1=3.72&r2=3.73
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/RTIA.hh?cvsroot=certi&r1=3.16&r2=3.17

Patches:
Index: RTIA.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/RTIA.cc,v
retrieving revision 3.26
retrieving revision 3.27
diff -u -b -r3.26 -r3.27
--- RTIA.cc     14 Sep 2009 20:51:51 -0000      3.26
+++ RTIA.cc     21 Sep 2009 15:42:11 -0000      3.27
@@ -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.26 2009/09/14 20:51:51 erk Exp $
+// $Id: RTIA.cc,v 3.27 2009/09/21 15:42:11 erk Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -33,15 +33,9 @@
 
 static pdCDebug D("RTIA", "(RTIA) ");
 
-// Tableau des messages pouvant etre recus du RTIG
-
-#define MSG_RTIG_MAX 18
-
-// ----------------------------------------------------------------------------
-//! RTIA constructor.
-RTIA::RTIA(int RTIA_port, int RTIA_fd)
-{
-    // No SocketServer is passed to the RootObject.
+RTIA::RTIA(int RTIA_port, int RTIA_fd) {
+    // No SocketServer is passed to the RootObject (RTIA use case)
+       // socket server are passed to RootObject iff we are in RTIG.
     rootObject = new RootObject(NULL);
 
     comm   = new Communications(RTIA_port, RTIA_fd);
@@ -57,14 +51,10 @@
     queues->fm = fm ;
     queues->dm = dm ;
     om->tm     = tm ;
-}
+} /* end of RTIA(int RTIA_port, int RTIA_fd) */
 
-// ----------------------------------------------------------------------------
-// RTIA Destructor
-RTIA::~RTIA()
-{
-    // BUG: TCP link destroyed ?
 
+RTIA::~RTIA() {
      // Remove temporary file (if not yet done)
      if ( fm->_FEDid.c_str() != NULL)
         {
@@ -95,7 +85,7 @@
     delete queues ;
     delete comm ;    
     delete rootObject ;
-}
+} /* end of ~RTIA() */
 
 // ----------------------------------------------------------------------------
 // displayStatistics
@@ -108,13 +98,8 @@
 }
 
 // ----------------------------------------------------------------------------
-//! RTIA mainloop.
-/*! Messages allocated for reading data exchange between RTIA and federate/RTIG
-  are freed by 'processFederateRequest' or 'processNetworkMessage'.
-*/
 void
-RTIA::execute()
-{
+RTIA::execute() {
     Message        *msg_un;
     NetworkMessage *msg_tcp_udp;
     int n ;
@@ -198,8 +183,8 @@
             assert(false);
         }
     }   
-}
+} /* end of execute() */
 
 }} // namespace certi/rtia
 
-// $Id: RTIA.cc,v 3.26 2009/09/14 20:51:51 erk Exp $
+// $Id: RTIA.cc,v 3.27 2009/09/21 15:42:11 erk Exp $

Index: RTIA_federate.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/RTIA_federate.cc,v
retrieving revision 3.96
retrieving revision 3.97
diff -u -b -r3.96 -r3.97
--- RTIA_federate.cc    7 Dec 2008 20:16:10 -0000       3.96
+++ RTIA_federate.cc    21 Sep 2009 15:42:11 -0000      3.97
@@ -1092,10 +1092,8 @@
     }
     stat.federateService(req->type);
     G.Out(pdGendoc,"exit  chooseFederateProcessing");
-}
+} /* end of RTIA::chooseFederateProcessing */
 
-// ----------------------------------------------------------------------------
-//! RTIA processes the TICK_REQUEST
 void
 RTIA::processOngoingTick()
 {
@@ -1156,10 +1154,8 @@
             assert(false);
         }
     }
-}
+} /* RTIA::processOngoingTick() */
 
-// ----------------------------------------------------------------------------
-//! RTIA processes a service request coming from federate.
 void
 RTIA::processFederateRequest(Message *req)
 {
@@ -1514,7 +1510,7 @@
        D.Out(pdDebug, "Reply send to Unix socket.");
     }
     G.Out(pdGendoc,"exit  RTIA::processFederateRequest");
-}
+} /* end of RTIA::processFederateRequest(Message *req) */
 
 }} // namespace certi/rtia
 

Index: FederationManagement.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/FederationManagement.cc,v
retrieving revision 3.72
retrieving revision 3.73
diff -u -b -r3.72 -r3.73
--- FederationManagement.cc     16 Sep 2009 07:56:31 -0000      3.72
+++ FederationManagement.cc     21 Sep 2009 15:42:11 -0000      3.73
@@ -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.72 2009/09/16 07:56:31 erk Exp $
+// $Id: FederationManagement.cc,v 3.73 2009/09/21 15:42:11 erk Exp $
 // ----------------------------------------------------------------------------
 
 #include <config.h>
@@ -222,7 +222,6 @@
         if (reponse->getException() == e_NO_EXCEPTION) {
             _nom_federation    = "" ;
             _numero_federation = 0 ;
-            _fin_execution     = true ;
             // Now, remove temporary file (if not yet done)
             if ( _FEDid.c_str() != NULL )
                {

Index: RTIA.hh
===================================================================
RCS file: /sources/certi/certi/RTIA/RTIA.hh,v
retrieving revision 3.16
retrieving revision 3.17
diff -u -b -r3.16 -r3.17
--- RTIA.hh     14 Sep 2009 20:51:51 -0000      3.16
+++ RTIA.hh     21 Sep 2009 15:42:11 -0000      3.17
@@ -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.hh,v 3.16 2009/09/14 20:51:51 erk Exp $
+// $Id: RTIA.hh,v 3.17 2009/09/21 15:42:11 erk Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef _CERTI_RTIA_HH
@@ -37,12 +37,36 @@
 namespace certi {
 namespace rtia {
 
+/**
+ * The RTI Ambassador class.
+ * This class is the Federate to RTI proxy class which is used
+ * to communication to/from the RTI.
+ * In current CERTI implementation RTIA is a seperate process
+ * which is created (forked) when the RTIambassador's federate
+ * constructor is called.
+ * RTIA is a reactive process which process Message from federate
+ * and NetworkMessage from RTIG.
+ */
 class RTIA
 {
 public:
+       /**
+        * RTIA constructor.
+        * @param[in] RTIA_port the TCP port used
+        * @param[in] RTIA_fd the file descriptor
+        */
     RTIA(int RTIA_port, int RTIA_fd);
+
+    /**
+     * RTIA destructor.
+     */
     ~RTIA();
 
+    /**
+     * The RTIA reactive [endless] main loop.
+     * Messages allocated for reading data exchange between RTIA and 
federate/RTIG
+     * are freed by 'processFederateRequest' or 'processNetworkMessage'.
+     */
     void execute();
     void displayStatistics();
 
@@ -62,9 +86,33 @@
     void saveAndRestoreStatus(Message::Type type)
         throw (SaveInProgress, RestoreInProgress);
 
-    void processNetworkMessage(NetworkMessage *);
-    void processFederateRequest(Message *);
-    void chooseFederateProcessing(Message *, Message &, TypeException &);
+    /**
+     * Process one message from RTIG (i.e. a NetworkMessage).
+     * @param[in] request
+     */
+    void processNetworkMessage(NetworkMessage * request);
+
+    /**
+     * Process a service request coming from the Federate (i.e. a Message).
+     * An answer in sent inside the call.
+     * @param[in,out] request the message request coming from the federate
+     *                the message is destroyed before return
+     */
+    void processFederateRequest(Message *request);
+
+    /**
+     * The method called by processFederateRequest in order to
+     * effectively process the request and build the appropriate
+     * answer.
+     * @param[in] request the federate request message
+     * @param[out] answer answer message to be sent back to the federate
+     * @param[out] e exception raised (if any).
+     */
+    void chooseFederateProcessing(Message *request, Message &answer, 
TypeException &e);
+
+    /**
+     * RTIA processes the TICK_REQUEST.
+     */
     void processOngoingTick();
 };
 
@@ -72,4 +120,4 @@
 
 #endif // _CERTI_RTIA_HH
 
-// $Id: RTIA.hh,v 3.16 2009/09/14 20:51:51 erk Exp $
+// $Id: RTIA.hh,v 3.17 2009/09/21 15:42:11 erk Exp $




reply via email to

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