Fix ae.c to avoid timers infinite loop.

This fix was suggested by Anthony LaTorre, that provided also a good
test case that was used to verify the fix.

The problem with the old implementation is that, the time returned by
a timer event (that is the time after it want to run again) is added
to the event *start time*. So if the event takes, in order to run, more
than the time it says it want to be scheduled again for running, an
infinite loop is triggered.
This commit is contained in:
antirez
2016-01-08 15:05:14 +01:00
parent 28c291c55c
commit 67b70a1813
4 changed files with 28 additions and 30 deletions

View File

@ -31,6 +31,8 @@
#ifndef ANET_H
#define ANET_H
#include <sys/types.h>
#define ANET_OK 0
#define ANET_ERR -1
#define ANET_ERR_LEN 256