[Lldb-commits] [PATCH] D111964: [lldb] [lldb-gdbserver] Unify listen/connect code to use ConnectionFileDescriptor
Michał Górny via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Oct 25 01:57:24 PDT 2021
mgorny added inline comments.
================
Comment at: lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp:647
+ uint16_t port = listening_socket.get()->GetLocalPortNumber();
+ socket_id_callback(port != 0 ? std::to_string(port) : "");
----------------
labath wrote:
> mgorny wrote:
> > labath wrote:
> > > Can this ever be zero ?
> > Yes, when `getsockname()` fails. I suppose we could modify it to use `llvm::Optional<...>` or even `llvm::Expected<...>` but this is one place where I don't think we need to care much about proper error handling.
> But how can it fail? This is a socket that we've just created and its totally under our control...
Yeah, exactly, that's why I said proper error handling is not very important there — but technically the function provides some potential error conditions. Are you suggesting we just pass zero as-is then?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111964/new/
https://reviews.llvm.org/D111964
More information about the lldb-commits
mailing list