add unique session ids

This commit is contained in:
Ron Pedde 2003-11-14 22:37:01 +00:00
parent 9bc76676b3
commit c7b28232c2
2 changed files with 15 additions and 0 deletions

View File

@ -92,6 +92,7 @@ typedef struct tag_scan_status {
SCAN_STATUS scan_status = { 0,0,NULL,NULL }; SCAN_STATUS scan_status = { 0,0,NULL,NULL };
pthread_mutex_t scan_mutex = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t scan_mutex = PTHREAD_MUTEX_INITIALIZER;
int config_session=0;
#define MAX_LINE 1024 #define MAX_LINE 1024
@ -669,3 +670,16 @@ int config_mutex_unlock(void) {
return 0; return 0;
} }
/*
* return the next available session ID
*/
int config_get_next_session(void) {
int session;
config_mutex_lock();
session=++config_session;
config_mutex_unlock();
return session;
}

View File

@ -30,5 +30,6 @@ extern int config_write(CONFIG *pconfig);
extern int config_auth(char *user, char *password); extern int config_auth(char *user, char *password);
extern void config_handler(WS_CONNINFO *pwsc); extern void config_handler(WS_CONNINFO *pwsc);
extern void config_set_status(WS_CONNINFO *pwsc, int session, char *fmt, ...); extern void config_set_status(WS_CONNINFO *pwsc, int session, char *fmt, ...);
extern int config_get_next_session(void);
#endif /* _CONFIGFILE_H_ */ #endif /* _CONFIGFILE_H_ */