Mercurial > hg > freeDiameter
changeset 1229:4e52f009861a
Fix setting of answer and expiry callbacks.
This corrects the interaction between rt_redirect and rt_busypeers,
where you could end up with a timeout and no expiry callback.
author | Thomas Klausner <tk@giga.or.at> |
---|---|
date | Thu, 18 Jul 2013 16:08:54 +0200 |
parents | e5010975da35 |
children | e72c9dad62ac |
files | libfdproto/messages.c |
diffstat | 1 files changed, 9 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libfdproto/messages.c Thu Jul 18 14:45:37 2013 +0200 +++ b/libfdproto/messages.c Thu Jul 18 16:08:54 2013 +0200 @@ -1254,11 +1254,15 @@ CHECK_PARAMS( (expirecb == NULL) || (msg->msg_cb.expirecb == NULL) ); /* We are not overwriting a cb */ /* Associate callback and data with the message, if any */ - msg->msg_cb.anscb = anscb; - msg->msg_cb.expirecb = expirecb; - msg->msg_cb.data = data; - if (timeout) { - memcpy(&msg->msg_cb.timeout, timeout, sizeof(struct timespec)); + if (anscb) { + msg->msg_cb.anscb = anscb; + msg->msg_cb.data = data; + } + if (expirecb) { + msg->msg_cb.expirecb = expirecb; + if (timeout) { + memcpy(&msg->msg_cb.timeout, timeout, sizeof(struct timespec)); + } } return 0;