It can be that select() waits for a few seconds before an event or
timeout arives. We didn't update mesh->loop.now before calling any of
the callback functions, which meant they could use a time a few seconds
in the past. In particular, the last_ping_time of connections could be
set to a value such that they would immediately be considered timed out.
fd_set readable;
fd_set writable;
+
while(loop->running) {
gettimeofday(&loop->now, NULL);
struct timeval diff, it, *tv = NULL;
pthread_mutex_lock(mutex);
}
+ gettimeofday(&loop->now, NULL);
+
if(n < 0) {
if(sockwouldblock(errno)) {
continue;