diff libfdproto/messages.c @ 1248:c9a160b815ea

Fix issue with anscb in the p_sr expiry mechanism. Thanks Guangming for the report.
author Sebastien Decugis <sdecugis@freediameter.net>
date Fri, 22 Nov 2013 16:07:42 +0100
parents e72c9dad62ac
children 0f215b0dda5e
line wrap: on
line diff
--- a/libfdproto/messages.c	Tue Nov 12 16:16:15 2013 +0800
+++ b/libfdproto/messages.c	Fri Nov 22 16:07:42 2013 +0100
@@ -1266,7 +1266,28 @@
 	}
 	
 	return 0;
-}	
+}
+
+/* Remove a callback */
+int fd_msg_anscb_reset(struct msg * msg, int clear_anscb, int clear_expirecb) 
+{
+	TRACE_ENTRY("%p %d %d", msg, clear_anscb, clear_expirecb);
+	
+	/* Check the parameters */
+	CHECK_PARAMS( CHECK_MSG(msg) );
+	
+	if (clear_anscb) {
+		msg->msg_cb.anscb = NULL;
+		msg->msg_cb.data = NULL;
+	}
+	if (clear_expirecb) {
+		msg->msg_cb.expirecb = NULL;
+		memset(&msg->msg_cb.timeout, 0, sizeof(struct timespec));
+	}
+	
+	return 0;
+}
+
 
 int fd_msg_anscb_get( struct msg * msg, void (**anscb)(void *, struct msg **), void (**expirecb)(void *, DiamId_t, size_t, struct msg **), void ** data )
 {
"Welcome to our mercurial repository"