[Lldb-commits] [PATCH] D14085: Make Socket to support plugin interface

Oleksiy Vyalov via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 26 13:46:16 PDT 2015

ovyalov added a comment.

In http://reviews.llvm.org/D14085#275507, @zturner wrote:

> I think most of the time they are used in a Connection class, but I don't think it's necessarily guaranteed they will always be that way.
> I can think of at least one use case in the future where we will need to open a socket to a server we don't control and stream some data down from the server.  I don't see the advantage of using a Connection in that case.
> So I would say: Right now it's probably always used in Connection, but I dont' want to lose the flexibility to use it standalone either.
> That said, IMO low-level OS primitive abstractions are by definition what Host is for, but higher level abstractions built on top of those can use the plugin interface

There are some corner cases that don't fit into regular model:

- Creation of UDP connection - LLDB uses pair of send/receive sockets and that's why we need to use UDPSocket::Connect instead of using factory method.
- ConnectionFileDescriptor::Connect creates a new TCP socket without giving up the ownership of a socket handle.

As an option, we can introduce static std::unique_ptr<Socket> Socket::Create(const char* scheme, bool child_processes_inherit, Error& error); as socket class creator method but without moving socket classes into plugins.


More information about the lldb-commits mailing list