Client: use TimeoutMonitor to track connection timeout
Don't use a global loop over the whole client list.
This commit is contained in:
@@ -28,13 +28,13 @@
|
||||
BufferedSocket::InputResult
|
||||
Client::OnSocketInput(const void *data, size_t length)
|
||||
{
|
||||
g_timer_start(last_activity);
|
||||
|
||||
const char *p = (const char *)data;
|
||||
const char *newline = (const char *)memchr(p, '\n', length);
|
||||
if (newline == NULL)
|
||||
return InputResult::MORE;
|
||||
|
||||
TimeoutMonitor::ScheduleSeconds(client_timeout);
|
||||
|
||||
char *line = g_strndup(p, newline - p);
|
||||
BufferedSocket::ConsumeInput(newline + 1 - p);
|
||||
|
||||
|
Reference in New Issue
Block a user