# HG changeset patch # User Sebastien Decugis # Date 1347536489 -7200 # Node ID 89c5849b0832e722dd99b8fc8f6ac2a42bf92a28 # Parent f145c687c5f37efd46cdd04d91169fd406b22617 Allow retransmission of messages on timeout diff -r f145c687c5f3 -r 89c5849b0832 libfdcore/messages.c --- a/libfdcore/messages.c Wed Sep 12 20:43:51 2012 +0200 +++ b/libfdcore/messages.c Thu Sep 13 13:41:29 2012 +0200 @@ -306,9 +306,7 @@ 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) ); diff -r f145c687c5f3 -r 89c5849b0832 libfdcore/p_sr.c --- a/libfdcore/p_sr.c Wed Sep 12 20:43:51 2012 +0200 +++ b/libfdcore/p_sr.c Thu Sep 13 13:41:29 2012 +0200 @@ -104,6 +104,9 @@ /* 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); diff -r f145c687c5f3 -r 89c5849b0832 libfdproto/messages.c --- a/libfdproto/messages.c Wed Sep 12 20:43:51 2012 +0200 +++ b/libfdproto/messages.c Thu Sep 13 13:41:29 2012 +0200 @@ -966,9 +966,9 @@ 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;