[Lldb-commits] [PATCH] D31823: Update LLDB Host to support IPv6 over TCP

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 11 05:19:45 PDT 2017


labath added a comment.

When I created the `MainLoop` class, i was hoping it would become the central place for all select-like functionality. Currently it uses pselect, but i don't see a reason we couldn't switch it to ppoll (but we actually don't have to, as the current implementation should work just fine for your use case). We also can-but-don't-have-to provide a specialized kevent-based implementation for mac&freebsd (afaict, kevent also supports listening for signals, but i would be fine with leaving that out even, as we don't need that functionality on these platforms). So all that needs to be added is a WSAPoll-based MainLoopWindows.

Then your `Listen` implementation would boil down to:

  for (auto socket: sockets)
    handles.emplace_back(loop.RegisterReadObject(socket, [&] { accepted = accept(socket, ...); loop.RequestTermination(); });
  loop.Run();

I'm not married to the current MainLoop interface in any way, so we can change it if you find the current one cumbersome, but I would like to cut down the number of selecting pieces of code.

What do you think about that?



================
Comment at: source/Host/common/TCPSocket.cpp:284
+#if defined(_WIN32)
+    int retval = WSAPoll(sock_set.data(), sock_set.size(), 1000);
+#else
----------------
Why not simply use infinite timeout if that's the behaviour you desire?


https://reviews.llvm.org/D31823





More information about the lldb-commits mailing list