Navigation


Changeset 340:81821e9f6988 in freeDiameter


Ignore:
Timestamp:
Jun 28, 2010, 11:20:48 AM (14 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Fix issue on session cleanup callback parameters -- thanks Souheil for reporting.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/app_radgw/rgwx_echodrop.c

    r270 r340  
    3939
    4040/* If a session is destroyed, empty the list of ed_saved_attribute */
    41 static void state_delete(void * arg) {
     41static void state_delete(void * arg, char * sid) {
    4242        struct fd_list * list = (struct fd_list *)arg;
    4343       
  • freeDiameter/tests/testsess.c

    r258 r340  
    4747};
    4848
    49 static void mycleanup( char * sid, struct mystate * data )
     49static void mycleanup( struct mystate * data, char * sid )
    5050{
    5151        /* sanity */
     
    268268                CHECK( NULL, tms );
    269269               
    270                 mycleanup(str1, ms[0]);
    271                 mycleanup(str1, ms[1]);
     270                mycleanup(ms[0], str1);
     271                mycleanup(ms[1], str1);
    272272               
    273273                /* Now create 6 states */
     
    350350                CHECK( 0, fd_sess_state_retrieve( hdl1, sess1, &tms ) );
    351351                CHECK( 0, fd_sess_getsid(sess1, &str1) );
    352                 mycleanup(str1, tms);
     352                mycleanup(tms, str1);
    353353        }
    354354       
  • include/freeDiameter/libfreeDiameter.h

    r336 r340  
    15271527 *  ENOMEM      : Not enough memory to complete the operation
    15281528 */
    1529 int fd_sess_handler_create_internal ( struct session_handler ** handler, void (*cleanup)(char * sid, session_state * state) );
     1529int fd_sess_handler_create_internal ( struct session_handler ** handler, void (*cleanup)(session_state * state, char * sid) );
    15301530/* Macro to avoid casting everywhere */
    15311531#define fd_sess_handler_create( _handler, _cleanup ) \
    1532         fd_sess_handler_create_internal( (_handler), (void (*)(char *, session_state *))(_cleanup) )
    1533 
     1532        fd_sess_handler_create_internal( (_handler), (void (*)(session_state *, char *))(_cleanup) )
     1533
     1534       
    15341535/*
    15351536 * FUNCTION:    fd_sess_handler_destroy
  • libfreeDiameter/sessions.c

    r293 r340  
    6969        int               eyec; /* An eye catcher also used to ensure the object is valid, must be SH_EYEC */
    7070        int               id;   /* A unique integer to identify this handler */
    71         void            (*cleanup)(char *, session_state *); /* The cleanup function to be called for cleaning a state */
     71        void            (*cleanup)(session_state *, char *); /* The cleanup function to be called for cleaning a state */
    7272};
    7373
     
    247247
    248248/* Create a new handler */
    249 int fd_sess_handler_create_internal ( struct session_handler ** handler, void (*cleanup)(char * sid, session_state * state) )
     249int fd_sess_handler_create_internal ( struct session_handler ** handler, void (*cleanup)(session_state * state, char * sid) )
    250250{
    251251        struct session_handler *new;
     
    318318                struct state * st = (struct state *)(deleted_states.next->o);
    319319                TRACE_DEBUG(FULL, "Calling cleanup handler for session '%s' and data %p", st->sid, st->state);
    320                 (*del->cleanup)(st->sid, st->state);
     320                (*del->cleanup)(st->state, st->sid);
    321321                free(st->sid);
    322322                fd_list_unlink(&st->chain);
     
    576576                fd_list_unlink(&st->chain);
    577577                TRACE_DEBUG(FULL, "Calling handler %p cleanup for state registered with session '%s'", st->hdl, sess->sid);
    578                 (*st->hdl->cleanup)(sess->sid, st->state);
     578                (*st->hdl->cleanup)(st->state, sess->sid);
    579579                free(st);
    580580        }
Note: See TracChangeset for help on using the changeset viewer.