comparison libfdcore/p_sr.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 0420ccc4671a
children
comparison
equal deleted inserted replaced
1247:2c09e2545188 1248:c9a160b815ea
114 struct timespec now; 114 struct timespec now;
115 struct sentreq * first; 115 struct sentreq * first;
116 struct msg * request; 116 struct msg * request;
117 struct fd_peer * sentto; 117 struct fd_peer * sentto;
118 void (*expirecb)(void *, DiamId_t, size_t, struct msg **); 118 void (*expirecb)(void *, DiamId_t, size_t, struct msg **);
119 void (*anscb)(void *, struct msg **);
120 void * data; 119 void * data;
121 int no_error; 120 int no_error;
122 121
123 CHECK_POSIX_DO( pthread_mutex_lock(&srlist->mtx), return NULL ); 122 CHECK_POSIX_DO( pthread_mutex_lock(&srlist->mtx), return NULL );
124 pthread_cleanup_push( fd_cleanup_mutex, &srlist->mtx ); 123 pthread_cleanup_push( fd_cleanup_mutex, &srlist->mtx );
174 if (!no_error) 173 if (!no_error)
175 break; 174 break;
176 175
177 176
178 /* Retrieve callback in the message */ 177 /* Retrieve callback in the message */
179 CHECK_FCT_DO( fd_msg_anscb_get( request, &anscb, &expirecb, &data ), break); 178 CHECK_FCT_DO( fd_msg_anscb_get( request, NULL, &expirecb, &data ), break);
180 ASSERT(expirecb); 179 ASSERT(expirecb);
181 180
182 /* Clean up this expirecb from the message */ 181 /* Clean up this expirecb from the message */
183 CHECK_FCT_DO( fd_msg_anscb_associate( request, anscb, data, NULL, NULL ), break); 182 CHECK_FCT_DO( fd_msg_anscb_reset( request, 0, 1 ), break);
184 183
185 /* Call it */ 184 /* Call it */
186 (*expirecb)(data, sentto->p_hdr.info.pi_diamid, sentto->p_hdr.info.pi_diamidlen, &request); 185 (*expirecb)(data, sentto->p_hdr.info.pi_diamid, sentto->p_hdr.info.pi_diamidlen, &request);
187 186
188 /* If the callback did not dispose of the message, do it now */ 187 /* If the callback did not dispose of the message, do it now */
"Welcome to our mercurial repository"