Navigation


Changeset 6:b0d377c79d80 in freeDiameter for libfreeDiameter/sessions.c


Ignore:
Timestamp:
Sep 3, 2009, 4:03:25 PM (15 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Progress on dispatch API spec; added fd_sess_reclaim function and test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfreeDiameter/sessions.c

    r5 r6  
    242242
    243243/* Create a new handler */
    244 int fd_sess_handler_create_int ( struct session_handler ** handler, void (*cleanup)(char * sid, session_state * state) )
     244int fd_sess_handler_create_internal ( struct session_handler ** handler, void (*cleanup)(char * sid, session_state * state) )
    245245{
    246246        struct session_handler *new;
     
    565565}
    566566
     567/* Destroy a session if it is not used */
     568int fd_sess_reclaim ( struct session ** session )
     569{
     570        struct session * sess;
     571       
     572        TRACE_ENTRY("%p", session);
     573        CHECK_PARAMS( session && VALIDATE_SI(*session) );
     574       
     575        sess = *session;
     576        *session = NULL;
     577       
     578        CHECK_FCT( pthread_mutex_lock( H_LOCK(sess->hash) ) );
     579        CHECK_FCT( pthread_mutex_lock( &exp_lock ) );
     580        if (FD_IS_LIST_EMPTY(&sess->states)) {
     581                fd_list_unlink( &sess->chain_h );
     582                fd_list_unlink( &sess->expire );
     583                sess->eyec = 0xdead;
     584                free(sess->sid);
     585                free(sess);
     586        }
     587        CHECK_FCT( pthread_mutex_unlock( &exp_lock ) );
     588        CHECK_FCT( pthread_mutex_unlock( H_LOCK(sess->hash) ) );
     589       
     590        return 0;
     591}
     592
    567593
    568594
    569595/* Save a state information with a session */
    570 int fd_sess_state_store_int ( struct session_handler * handler, struct session * session, session_state ** state )
     596int fd_sess_state_store_internal ( struct session_handler * handler, struct session * session, session_state ** state )
    571597{
    572598        struct state *new;
     
    617643
    618644/* Get the data back */
    619 int fd_sess_state_retrieve_int ( struct session_handler * handler, struct session * session, session_state ** state )
     645int fd_sess_state_retrieve_internal ( struct session_handler * handler, struct session * session, session_state ** state )
    620646{
    621647        struct fd_list * li;
Note: See TracChangeset for help on using the changeset viewer.