Ver Fonte

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 há 15 anos atrás
pai
commit
25604cb4d5
1 ficheiros alterados com 7 adições e 0 exclusões
  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);