add: struct timeval in Client class, and lifeTime in Request

This commit is contained in:
Talyx
2022-02-01 18:34:50 +03:00
parent f8343098e8
commit 0efe9d1bc3
5 changed files with 28 additions and 1 deletions

View File

@@ -195,6 +195,22 @@ bool Client::isEmpty(void)
return (false);
}
bool Client::TimeToDie(void)
{
struct timeval curTime;
gettimeofday(&curTime, NULL);
if ((curTime.tv_sec - _time.tv_sec) >= _request.getLifeTime())
return (true);
else
return (false);
}
void Client::updateTimeToDie(void)
{
gettimeofday(&_time, NULL);
}
void Client::clear(void)
{
_fd = -1;