Vendor import of lldb release_50 branch r312293:
https://llvm.org/svn/llvm-project/lldb/branches/release_50@312293
This commit is contained in:
parent
f9cfece4e8
commit
50640c9156
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/lldb/dist/; revision=323098 svn path=/vendor/lldb/lldb-release_500-r312559/; revision=323244; tag=vendor/lldb/lldb-release_500-r312559
@ -198,9 +198,14 @@ Status TCPSocket::Listen(llvm::StringRef name, int backlog) {
|
||||
::setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, option_value_p,
|
||||
sizeof(option_value));
|
||||
|
||||
address.SetPort(port);
|
||||
SocketAddress listen_address = address;
|
||||
if(!listen_address.IsLocalhost())
|
||||
listen_address.SetToAnyAddress(address.GetFamily(), port);
|
||||
else
|
||||
listen_address.SetPort(port);
|
||||
|
||||
int err = ::bind(fd, &address.sockaddr(), address.GetLength());
|
||||
int err =
|
||||
::bind(fd, &listen_address.sockaddr(), listen_address.GetLength());
|
||||
if (-1 != err)
|
||||
err = ::listen(fd, backlog);
|
||||
|
||||
|
@ -220,3 +220,14 @@ TEST_F(SocketTest, UDPConnect) {
|
||||
EXPECT_TRUE(error.Success());
|
||||
EXPECT_TRUE(socket_up->IsValid());
|
||||
}
|
||||
|
||||
TEST_F(SocketTest, TCPListen0GetPort) {
|
||||
Socket *server_socket;
|
||||
Predicate<uint16_t> port_predicate;
|
||||
port_predicate.SetValue(0, eBroadcastNever);
|
||||
Status err =
|
||||
Socket::TcpListen("10.10.12.3:0", false, server_socket, &port_predicate);
|
||||
std::unique_ptr<TCPSocket> socket_up((TCPSocket*)server_socket);
|
||||
EXPECT_TRUE(socket_up->IsValid());
|
||||
EXPECT_NE(socket_up->GetLocalPortNumber(), 0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user