# HG changeset patch # User Thomas Klausner # Date 1374156534 -7200 # Node ID 4e52f009861a456e1aab5548d33d72de001f89a5 # Parent e5010975da35a408cf5dabcc47482972b5500a9c 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. diff -r e5010975da35 -r 4e52f009861a libfdproto/messages.c --- 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;