Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inspector, test: Fix test bug detected by Coverity #13799

Merged
merged 1 commit into from
Jun 21, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions test/cctest/test_inspector_socket_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,14 @@ class SocketWrapper {
contents_.clear();
uv_tcp_init(loop_, &socket_);
union {sockaddr generic; sockaddr_in v4; sockaddr_in6 v6;} addr;
int err = 0;
if (v6) {
uv_ip6_addr(host.c_str(), port, &addr.v6);
err = uv_ip6_addr(host.c_str(), port, &addr.v6);
} else {
uv_ip4_addr(host.c_str(), port, &addr.v4);
err = uv_ip4_addr(host.c_str(), port, &addr.v4);
}
int err = uv_tcp_connect(&connect_, &socket_, &addr.generic, Connected_);
ASSERT_EQ(0, err);
err = uv_tcp_connect(&connect_, &socket_, &addr.generic, Connected_);
ASSERT_EQ(0, err);
SPIN_WHILE(!connected_)
uv_read_start(reinterpret_cast<uv_stream_t*>(&socket_), AllocCallback,
Expand Down Expand Up @@ -618,7 +620,7 @@ TEST_F(InspectorSocketServerTest, BindsToIpV6) {
ASSERT_TRUE(server->Start());

SocketWrapper socket1(&loop);
socket1.Connect("[::]", server.port(), true);
socket1.Connect("::", server.port(), true);
socket1.Write(WsHandshakeRequest(MAIN_TARGET_ID));
socket1.Expect(WS_HANDSHAKE_RESPONSE);
server->Stop(ServerHolder::CloseCallback);
Expand Down