Skip to content

Commit

Permalink
Fix folly/io/async/test:async_test - AsyncSocketTest.ConnectionExpiry
Browse files Browse the repository at this point in the history
Summary: The worker thread just needed to be killed before the `AcceptCallback`. `AsyncServerSocket` calls a method on this callback class in its dtor, so it must either be alive or removed using `removeAcceptCallback`.

Differential Revision: D24972293

fbshipit-source-id: 2c7b6d64c2b9b8c00d03107002fa31e565df2a01
  • Loading branch information
praihan authored and dotconnor committed Mar 18, 2021
1 parent 1d2585f commit 70797a0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion folly/io/async/test/AsyncSocketTest2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4210,7 +4210,6 @@ TEST(AsyncSocketTest, ConnectionExpiry) {
constexpr auto kConnectionExpiryDuration = milliseconds(10);
serverSocket->setQueueTimeout(kConnectionExpiryDuration);

ScopedEventBaseThread acceptThread("ioworker_test");
TestAcceptCallback acceptCb;
acceptCb.setConnectionAcceptedFn(
[&, called = false](auto&&...) mutable {
Expand All @@ -4230,6 +4229,7 @@ TEST(AsyncSocketTest, ConnectionExpiry) {
// second message expires before it has a chance to dequeue.
std::this_thread::sleep_for(kConnectionExpiryDuration);
});
ScopedEventBaseThread acceptThread("ioworker_test");

TestConnectionEventCallback connectionEventCb;
serverSocket->setConnectionEventCallback(&connectionEventCb);
Expand Down

0 comments on commit 70797a0

Please sign in to comment.