Thu 18 Sep 2008 10:23:09 AM UTC, comment #5:
Yes we can.
In fact for NetworkMessage there is
a remainder of a
CLOSE_CONNEXION message
which does not exists for "Message".
I say it's a remainder because RTIG handles the
CloseConnexion NetworkMessage but the RTIA does
not sends it !!
The only trouble with such message is
when will Federate close the socket after
sending CLOSE_CONNEXION message?
When will it be sure the RTIA have processed the message?
My be, once the CLOSE_CONNEXION message is sent
from Federate to RTIA, the Federate should wait
for RTIA to receive the message and close the socket
on its side and be prepared to silently ignore SIGPIPE
or NetworkException.
I think that the appropriate algorithm would be:
Federate sends Message::CLOSE_CONNEXION to RTIA
and prepare itself for Federate<-->RTIA socket closure.
As soons as RTIA receive the Message
1) it sends NetworkMessage::CLOSE_CONNEXION to RTIG
2) prepare itself for RTIA<-->RTIG socket closure
3) once the RTIA<-->RIG socket is closed then
the RTIA close the Federate<-->RTIA socket
When Federate sees that the socket has been closed by
RTIA it terminates properly.
Socket closure handling may be done in
RTIambassador destructor for the Federate
RTIA destructor for the RTIA
what do you think?
|