If a program detects an error, such as TipcConnMainLoop or TipcConnFlush fails, recovery is typically initiated by creating a new connection and then calling TipcConnGmdResend to resend the old GMD messages. For example:
if (!TipcConnFlush(conn)) { TutOut("Lost connection to server process.\n");/* destroy old connection and create new one */
if (!TipcConnDestroy(conn)) {/* error */
} conn = connect_to_server();/* resend messages from GMD area (N/A for memory-only GMD) */
if (!TipcConnGmdResend(conn)) {/* error */
} }
TipcConnGmdResend automatically calls TipcConnGmdFileCreate if necessary. TipcConnGmdResend reads all messages from the connection GMD area, preserves their sequence numbers, marks them as being resent (through an internal message resend property), and sends them with TipcConnMsgSend. Resending GMD messages does not change their timestamps used to detect delivery timeouts; this prevents repetitive resends from hiding delivery timeout detection. Note that with memory-only GMD there can be no resending, as the GMD area is lost when the old connection is destroyed.
When a process using GMD creates a client connection with TipcConnCreateClient or accepts a connection from a client with TipcConnAccept, it typically does one of two things:
Both the publishing client and the RTserver have a GMD area and GMD messages are stored in both. If the RTserver goes down, the publishing client has all the GMD messages in its own GMD area and can resend those messages when it connects back into the RTserver cloud.
As described in Receiving Messages and Resending Messages, when duplicate messages are received, they are always messages that have been resent. Resent messages always have their sequence numbers checked against the highest sequence number stored in the connection GMD area.
In the previous example, if the server program was sent the two INFO messages twice, the second set of messages produces this output:
read: type info, seq_num 1 INFO field: GMD test #1 write: type gmd_ack, seq_num 0 GMD_ACK field: 1 read: type info, seq_num 2 INFO field: GMD test #2 write: type gmd_ack, seq_num 0 GMD_ACK field: 2
Note how acknowledgments are sent immediately to notify the sender that the receiver has already processed these messages.
TIBCO SmartSockets™ User’s Guide Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |