[Lldb-commits] [lldb] [lldb] Updated TCPSocket to listen multiple ports on the same single thread (PR #104797)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Tue Aug 27 04:00:41 PDT 2024
labath wrote:
Having a single socket listen on multiple ports sounds like a bad idea to me. The socket class is complicated enough as it is, and it's not the way the MainLoop class was meant to be used (the idea being for it to be created at the topmost level possible, so that any number of users could register their handlers).
I think that a better and more versatile API would be something like:
```
std::vector<MainLoop::ReadHandleUP> /*or sth like that*/ TCPSocket::Accept(MainLoop &mainloop, std::function<void(std::unique_ptr<TCPSocket> accepted_socket)> /*or similar*/ socket_cb);
```
Then we could create two sockets and have them listen on the same main loop instance. It should be possible to reimplement the existing TCPSocket::Accept function on top of this API.
https://github.com/llvm/llvm-project/pull/104797
More information about the lldb-commits
mailing list