Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Kea
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
416
Issues
416
List
Boards
Labels
Service Desk
Milestones
Merge Requests
66
Merge Requests
66
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ISC Open Source Projects
Kea
Commits
fe19cac6
Commit
fe19cac6
authored
Mar 02, 2017
by
Marcin Siodelski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[master] Prevent sporadic TCPAcceptor test failures by using reuse address.
This change was okayed on jabber.
parent
8c6f5879
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
src/lib/asiolink/tests/tcp_acceptor_unittest.cc
src/lib/asiolink/tests/tcp_acceptor_unittest.cc
+14
-3
No files found.
src/lib/asiolink/tests/tcp_acceptor_unittest.cc
View file @
fe19cac6
...
...
@@ -229,6 +229,12 @@ public:
return
(
endpoint_copy
);
}
/// @brief Opens TCP acceptor and sets 'reuse address' option.
void
acceptorOpen
()
{
acceptor_
.
open
(
endpoint_
);
acceptor_
.
setOption
(
TestTCPAcceptor
::
ReuseAddress
(
true
));
}
/// @brief Starts accepting TCP connections.
///
/// This method creates new Acceptor instance and calls accept() to start
...
...
@@ -324,7 +330,7 @@ TEST_F(TCPAcceptorTest, asyncAccept) {
setMaxConnections
(
10
);
// Initialize acceptor.
acceptor
_
.
open
(
endpoint_
);
acceptor
Open
(
);
acceptor_
.
bind
(
endpoint_
);
acceptor_
.
listen
();
...
...
@@ -387,15 +393,18 @@ TEST_F(TCPAcceptorTest, getNative) {
// Initially the descriptor should be invalid (negative).
ASSERT_LT
(
acceptor_
.
getNative
(),
0
);
// Now open the socket and make sure the returned descriptor is now valid.
ASSERT_NO_THROW
(
acceptor
_
.
open
(
endpoint_
));
ASSERT_NO_THROW
(
acceptor
Open
(
));
EXPECT_GE
(
acceptor_
.
getNative
(),
0
);
}
// macOS 10.12.3 has a bug which causes the connections to not enter
// the TIME-WAIT state and they never get closed.
#if !defined (OS_OSX)
// Test that TCPAcceptor::close works properly.
TEST_F
(
TCPAcceptorTest
,
close
)
{
// Initialize acceptor.
acceptor
_
.
open
(
endpoint_
);
acceptor
Open
(
);
acceptor_
.
bind
(
endpoint_
);
acceptor_
.
listen
();
...
...
@@ -419,4 +428,6 @@ TEST_F(TCPAcceptorTest, close) {
EXPECT_EQ
(
1
,
connections_
.
size
());
}
#endif
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment