comparison libfdproto/messages.c @ 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 c38bb8b69c43
children e72c9dad62ac
comparison
equal deleted inserted replaced
1228:e5010975da35 1229:4e52f009861a
1252 1252
1253 CHECK_PARAMS( (anscb == NULL) || (msg->msg_cb.anscb == NULL) ); /* We are not overwriting a cb */ 1253 CHECK_PARAMS( (anscb == NULL) || (msg->msg_cb.anscb == NULL) ); /* We are not overwriting a cb */
1254 CHECK_PARAMS( (expirecb == NULL) || (msg->msg_cb.expirecb == NULL) ); /* We are not overwriting a cb */ 1254 CHECK_PARAMS( (expirecb == NULL) || (msg->msg_cb.expirecb == NULL) ); /* We are not overwriting a cb */
1255 1255
1256 /* Associate callback and data with the message, if any */ 1256 /* Associate callback and data with the message, if any */
1257 msg->msg_cb.anscb = anscb; 1257 if (anscb) {
1258 msg->msg_cb.expirecb = expirecb; 1258 msg->msg_cb.anscb = anscb;
1259 msg->msg_cb.data = data; 1259 msg->msg_cb.data = data;
1260 if (timeout) { 1260 }
1261 memcpy(&msg->msg_cb.timeout, timeout, sizeof(struct timespec)); 1261 if (expirecb) {
1262 msg->msg_cb.expirecb = expirecb;
1263 if (timeout) {
1264 memcpy(&msg->msg_cb.timeout, timeout, sizeof(struct timespec));
1265 }
1262 } 1266 }
1263 1267
1264 return 0; 1268 return 0;
1265 } 1269 }
1266 1270
"Welcome to our mercurial repository"