[IOMultiplexer] fixed possible endless loop when appending a timer to the descriptor...
[IOMultiplexer.git] / src / IOHandler.c
index 4f057e8ef3db36cb4bd65dac770172090eba8ed6..e4fa1dd6dd30e16c9df9e57c64926e9f7826e3e8 100644 (file)
@@ -111,9 +111,9 @@ static void iohandler_append(struct IODescriptor *descriptor) {
                 if(timeval_is_smaler(timeout, (&iofd->timeout))) {
                     descriptor->prev = iofd->prev;
                     descriptor->next = iofd;
-                    iofd->prev = descriptor;
                     if(iofd->prev)
                         iofd->prev->next = descriptor;
+                    iofd->prev = descriptor;
                     if(set_priority)
                         timer_priority = descriptor;
                     break;