Added a generic way to reset last read/write variables.
This commit is contained in:
parent
ddc91d1640
commit
ff47281197
15
src/user.c
15
src/user.c
|
@ -333,7 +333,9 @@ int user_is_registered(struct user* user)
|
|||
|
||||
void user_net_io_want_write(struct user* user)
|
||||
{
|
||||
#ifdef DEBUG_SENDQ
|
||||
hub_log(log_trace, "user_net_io_want_write: %s", user_log_str(user));
|
||||
#endif
|
||||
if (user && user->net.ev_write)
|
||||
{
|
||||
event_add(user->net.ev_write, 0);
|
||||
|
@ -342,8 +344,9 @@ void user_net_io_want_write(struct user* user)
|
|||
|
||||
void user_net_io_want_read(struct user* user, int timeout_s)
|
||||
{
|
||||
#ifdef DEBUG_SENDQ
|
||||
hub_log(log_trace, "user_net_io_want_read: %s", user_log_str(user));
|
||||
|
||||
#endif
|
||||
struct timeval timeout = { timeout_s, 0 };
|
||||
if (user && user->net.ev_read)
|
||||
{
|
||||
|
@ -351,4 +354,14 @@ void user_net_io_want_read(struct user* user, int timeout_s)
|
|||
}
|
||||
}
|
||||
|
||||
void user_reset_last_write(struct user* user)
|
||||
{
|
||||
user->net.tm_last_write = time(NULL);
|
||||
}
|
||||
|
||||
void user_reset_last_read(struct user* user)
|
||||
{
|
||||
user->net.tm_last_read = time(NULL);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -283,7 +283,15 @@ extern void user_net_io_want_write(struct user* user);
|
|||
*/
|
||||
extern void user_net_io_want_read(struct user* user, int timeout_s);
|
||||
|
||||
/**
|
||||
* Reset the last-write timer.
|
||||
*/
|
||||
extern void user_reset_last_write(struct user* user);
|
||||
|
||||
/**
|
||||
* Reset the last-write timer.
|
||||
*/
|
||||
extern void user_reset_last_read(struct user* user);
|
||||
|
||||
#endif /* HAVE_UHUB_USER_H */
|
||||
|
||||
|
|
Loading…
Reference in New Issue