FLTK has a lot of synchronous stuff (like dialogs), which mean that the
main loop might be run recursively in some cases. If there is data
available on our socket then CConn::socketEvent() will be called
constantly in a busy loop.
Avoid this by removing socket notifications whilst we are processing
data.
cc = (CConn*)data;
// I don't think processMsg() is recursion safe, so add this check
- if (recursing)
- return;
+ assert(!recursing);
recursing = true;
+ Fl::remove_fd(fd);
try {
// We might have been called to flush unwritten socket data
Fl::add_fd(fd, when, socketEvent, data);
recursing = false;
+ Fl::add_fd(fd, FL_READ | FL_EXCEPT, socketEvent, data);
}
////////////////////// CConnection callback methods //////////////////////