Просмотр исходного кода

BReactor: add note about a bug that could cause an infinite loop if an error occurs, but no events are requested.
Seems not to happen in practice.

ambrop7 15 лет назад
Родитель
Сommit
25604cb4d5
1 измененных файлов с 7 добавлено и 0 удалено
  1. 7 0
      system/BReactor.c

+ 7 - 0
system/BReactor.c

@@ -238,6 +238,13 @@ static void dispatch_io (BReactor *bsys)
             }
         }
         
+        // BUG: if an error occurs on the socket and neither BREACTOR_READ nor BREACTOR_WRITE were requested,
+        // we get the event from epoll as ready, but don't have anybody to tell about it, resulting in an
+        // infinite loop
+        if (!events) {
+            continue;
+        }
+        
         // call handler
         BLog(BLOG_DEBUG, "Dispatching file descriptor");
         bfd->handler(bfd->user, events);