Mercurial > hg > freeDiameter
changeset 824:89c5849b0832
Allow retransmission of messages on timeout
author | Sebastien Decugis <sdecugis@freediameter.net> |
---|---|
date | Thu, 13 Sep 2012 13:41:29 +0200 |
parents | f145c687c5f3 |
children | 034a475a3eb0 |
files | libfdcore/messages.c libfdcore/p_sr.c libfdproto/messages.c |
diffstat | 3 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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) );
--- 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);
--- 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;