Commit 2bbd752e authored by Sebastien Decugis's avatar Sebastien Decugis
Browse files

Allow retransmission of messages on timeout

parent edaeaeff
......@@ -306,9 +306,7 @@ int fd_msg_send ( struct msg ** pmsg, void (*anscb)(void *, struct msg **), void
CHECK_PARAMS( pmsg );
/* Save the callback in the message */
if (anscb) {
CHECK_FCT( fd_msg_anscb_associate( *pmsg, anscb, data, NULL /* we should maybe use a safeguard here like 1 hour or so? */ ) );
}
CHECK_FCT( fd_msg_anscb_associate( *pmsg, anscb, data, NULL /* we should maybe use a safeguard here like 1 hour or so? */ ) );
/* Post the message in the outgoing queue */
CHECK_FCT( fd_fifo_post(fd_g_outgoing, pmsg) );
......
......@@ -104,6 +104,9 @@ static void * call_anscb_expire(void * arg) {
/* Retrieve callback in the message */
CHECK_FCT_DO( fd_msg_anscb_get( expired_req, &anscb, &data ), return NULL);
ASSERT(anscb);
/* Clean up this data from the message */
CHECK_FCT_DO( fd_msg_anscb_associate( expired_req, NULL, NULL, NULL ), return NULL);
/* Call it */
(*anscb)(data, &expired_req);
......
......@@ -966,9 +966,9 @@ int fd_msg_anscb_associate( struct msg * msg, void ( *anscb)(void *, struct msg
TRACE_ENTRY("%p %p %p", msg, anscb, data);
/* Check the parameters */
CHECK_PARAMS( CHECK_MSG(msg) && anscb );
CHECK_PARAMS( CHECK_MSG(msg) );
CHECK_PARAMS( msg->msg_public.msg_flags & CMD_FLAG_REQUEST ); /* we associate with requests only */
CHECK_PARAMS( msg->msg_cb.fct == NULL ); /* No cb is already registered */
CHECK_PARAMS( (anscb == NULL) || (msg->msg_cb.fct == NULL) ); /* We are not overwritting a cb */
/* Associate callback and data with the message, if any */
msg->msg_cb.fct = anscb;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment