TipcConnGmdMsgResend resend a message after a GMD failure on a connection
conn
connection on which to resend message
msg
message to resend
TRUE
if the guaranteed message was successfully resent on the connection, FALSE
otherwise.
If TipcConnGmdMsgResend fails, it returns FALSE
and sets the global SmartSockets error number to one of:
TipcConnGmdMsgResend resends a messages after a GMD failure on a connection. TipcConnGmdMsgResend is intended to be used from a GMD_FAILURE connection process callback to resend a message with GMD. TipcConnGmdMsgResend preserves the sequence number property of the message and then calls TipcConnMsgSend to resend the message. The receiving processes automatically detect any redundant messages they have already processed.
When a GMD_FAILURE message is processed by a sender, one of two scenarios is possible:
See TipcCbConnProcessGmdFailure and TipcCbSrvProcessGmdFailure for more information on processing GMD_FAILURE messages.
TipcConnGmdMsgResend should only be used from a GMD_FAILURE process callback.
If TipcConnMsgSend is used instead of TipcConnGmdMsgResend from a GMD_FAILURE process callback, then the message gets a new sequence number and the receiver may process the message twice.
TipcConnGmdMsgResend resends a message with GMD, but does not explicitly flush the message. See TipcConnGetAutoFlushSize for more information on message buffering.
The T_ENTRY declaration specifier is required in the definition of all callback functions as well as their prototypes.
TipcCbConnProcessGmdFailure, TipcCbSrvProcessGmdFailure, TipcConnGmdMsgDelete
This example creates a connection process callback for GMD_FAILURE messages which resends the message that failed. The existing callback TipcCbConnProcessGmdFailure is destroyed to avoid interfering with the new callback:
void T_ENTRY my_gmd_failure_cb(conn, data, arg) T_IPC_CONN conn; T_IPC_CONN_PROCESS_CB_DATA data; T_CB_ARG arg;/* not used */
{ T_IPC_MSG failed_msg;/* go to the first field of the GMD_FAILURE message */
if (!TipcMsgSetCurrent(data->msg, 0)) {return
; /* error */
}/* read the first field of the GMD_FAILURE message, which is */
/* the message where GMD failed */
if (!TipcMsgNextMsg(data->msg, &failed_msg))return
; /* error */
}/* at this point, a sender would typically take some */
/* application-specific corrective action before resending */
/* the message */
take_corrective_actions();/* resend the message with GMD */
if (!TipcConnGmdMsgResend(conn, failed_msg)) {return
; /* error */
} }/* my_gmd_failure_cb */
/* =========================================================== */
/*...code from calling function is below */
T_IPC_MT mt; T_CB cb; mt = TipcMtLookupByNum(T_MT_GMD_FAILURE); if (mt == NULL) {return
; /* error */
}/* create connection process callback for GMD_FAILURE messages */
if (TipcConnProcessCbCreate(conn, mt, my_gmd_failure_cb, NULL) == NULL) {return
; /* error */
}/* destroy standard callback for GMD_FAILURE messages */
cb = TipcConnProcessCbLookup(conn, mt, TipcCbConnProcessGmdFailure, NULL); if (cb == NULL) {return
; /* error */
} if (!TutCbDestroy(cb)) {return
; /* error */
}
TIBCO SmartSockets™ Application Programming Interface Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |