Add session timer

This commit is contained in:
luwenpeng
2023-12-12 18:41:53 +08:00
parent 006315fb7c
commit 2d3e182b5a
11 changed files with 612 additions and 234 deletions

View File

@@ -0,0 +1,26 @@
#ifndef _SESSION_TIMER_H
#define _SESSION_TIMER_H
#ifdef __cpluscplus
extern "C"
{
#endif
#include "session.h"
struct session_timer;
struct session_timer *session_timer_create();
void session_timer_destroy(struct session_timer *timer);
void session_timer_add_session(struct session_timer *timer, struct session *sess);
void session_timer_del_session(struct session_timer *timer, struct session *sess);
/*
* return one session which timeout, or NULL if no session timeout.
* if return session, the session will be removed from timer.
*/
struct session *session_timer_expire_session(struct session_timer *timer, uint64_t abs_current_ts);
#ifdef __cpluscplus
}
#endif
#endif