Navigation


Changeset 1248:c9a160b815ea in freeDiameter


Ignore:
Timestamp:
Nov 23, 2013, 12:07:42 AM (10 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Fix issue with anscb in the p_sr expiry mechanism. Thanks Guangming for the report.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • include/freeDiameter/libfdproto.h

    r1243 r1248  
    24892489int fd_msg_anscb_associate( struct msg * msg, void ( *anscb)(void *, struct msg **), void  * data, void (*expirecb)(void *, DiamId_t, size_t, struct msg **), const struct timespec *timeout );
    24902490int fd_msg_anscb_get( struct msg * msg, void (**anscb)(void *, struct msg **), void (**expirecb)(void *, DiamId_t, size_t, struct msg **), void ** data );
     2491int fd_msg_anscb_reset(struct msg * msg, int clear_anscb, int clear_expirecb);
    24912492struct timespec *fd_msg_anscb_gettimeout( struct msg * msg ); /* returns NULL or a valid non-0 timespec */
    24922493
  • libfdcore/p_sr.c

    r1240 r1248  
    117117                struct fd_peer * sentto;
    118118                void (*expirecb)(void *, DiamId_t, size_t, struct msg **);
    119                 void (*anscb)(void *, struct msg **);
    120119                void * data;
    121120                int no_error;
     
    177176               
    178177                /* 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);
    180179                ASSERT(expirecb);
    181180       
    182181                /* 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);
    184183
    185184                /* Call it */
  • libfdproto/messages.c

    r1230 r1248  
    12671267       
    12681268        return 0;
    1269 }       
     1269}
     1270
     1271/* Remove a callback */
     1272int fd_msg_anscb_reset(struct msg * msg, int clear_anscb, int clear_expirecb)
     1273{
     1274        TRACE_ENTRY("%p %d %d", msg, clear_anscb, clear_expirecb);
     1275       
     1276        /* Check the parameters */
     1277        CHECK_PARAMS( CHECK_MSG(msg) );
     1278       
     1279        if (clear_anscb) {
     1280                msg->msg_cb.anscb = NULL;
     1281                msg->msg_cb.data = NULL;
     1282        }
     1283        if (clear_expirecb) {
     1284                msg->msg_cb.expirecb = NULL;
     1285                memset(&msg->msg_cb.timeout, 0, sizeof(struct timespec));
     1286        }
     1287       
     1288        return 0;
     1289}
     1290
    12701291
    12711292int fd_msg_anscb_get( struct msg * msg, void (**anscb)(void *, struct msg **), void (**expirecb)(void *, DiamId_t, size_t, struct msg **), void ** data )
Note: See TracChangeset for help on using the changeset viewer.