[Lldb-commits] [lldb] [lldb] Updated TCPSocket to listen multiple ports on the same single thread (PR #104797)

Dmitry Vasilyev via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 27 05:06:05 PDT 2024


slydiman wrote:

@labath 
> Having a single socket listen on multiple ports sounds like a bad idea to me. 

Note that currently the class TCPSocket already contains a list of NativeSocket `m_listen_sockets`. 
We do not need 2 TCPSocket instances with 2 separated lists of native sockets even with a common MainLoop.

We have 2 options:
- A) 2 threads - first one calls TCPSocket::Accept() for the platform connection, second calls TCPSocket::Accept() for the gdb connection
- B) 1 thread - a common TCPSocket::Accept() can accept platform and gdb connections from both ports

You don't like multithreading. So I implemented the option B. It was easy because the class TCPSocket already contains  `m_listen_sockets`. 

https://github.com/llvm/llvm-project/pull/104797


More information about the lldb-commits mailing list