Changeset 778:003df4a9ade2 in freeDiameter for libfdproto/sessions.c
- Timestamp:
- Jan 22, 2012, 12:11:34 AM (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libfdproto/sessions.c
r740 r778 115 115 #define H_LOCK( _hash ) (&(sess_hash[H_MASK(_hash)].lock )) 116 116 117 static uint32_t sess_cnt = 0; /* counts all active session (that are in the expiry list) */ 118 117 119 /* The following are used to generate sid values that are eternaly unique */ 118 120 static uint32_t sid_h; /* initialized to the current time in fd_sess_init */ … … 485 487 } 486 488 fd_list_insert_after( li, &sess->expire ); 489 sess_cnt++; 487 490 488 491 /* We added a new expiring element, we must signal */ … … 612 615 /* Unlink from the expiry list */ 613 616 CHECK_POSIX_DO( pthread_mutex_lock( &exp_lock ), { ASSERT(0); /* otherwise cleanup handler is not pop'd */ } ); 614 fd_list_unlink( &sess->expire ); /* no need to signal the condition here */ 617 if (!FD_IS_LIST_EMPTY(&sess->expire)) { 618 sess_cnt--; 619 fd_list_unlink( &sess->expire ); /* no need to signal the condition here */ 620 } 615 621 CHECK_POSIX_DO( pthread_mutex_unlock( &exp_lock ), { ASSERT(0); /* otherwise cleanup handler is not pop'd */ } ); 616 622 … … 890 896 fd_log_debug("\t %*s -- end of handler @%p --\n", level, "", handler); 891 897 } 898 899 int fd_sess_getcount(uint32_t *cnt) 900 { 901 CHECK_PARAMS(cnt); 902 CHECK_POSIX( pthread_mutex_lock( &exp_lock ) ); 903 *cnt = sess_cnt; 904 CHECK_POSIX( pthread_mutex_unlock( &exp_lock ) ); 905 return 0; 906 }
Note: See TracChangeset
for help on using the changeset viewer.