From 4ffad0ef35644c57f94802c003017da3269e8caa Mon Sep 17 00:00:00 2001 From: Dave Watson Date: Wed, 10 Dec 2014 14:34:00 -0800 Subject: [PATCH] Only test multi accept if reuse port supported Summary: Some contbuild machines aren't on 3.10 yet. Test Plan: fbconfig folly/experimental/wangle/bootstrap; fbmake runtests tested on 3.2 and 3.10 Reviewed By: jsedgwick@fb.com Subscribers: doug, fugalh, folly-diffs@ FB internal diff: D1732040 Tasks: 5800250 Signature: t1:1732040:1418250452:a3203ab5769494594f2bf0b50f1c62052ddeb24c --- .../wangle/bootstrap/BootstrapTest.cpp | 14 ++++++++++++++ .../wangle/bootstrap/ServerBootstrap.h | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/folly/experimental/wangle/bootstrap/BootstrapTest.cpp b/folly/experimental/wangle/bootstrap/BootstrapTest.cpp index b3cf00da..25bb75ea 100644 --- a/folly/experimental/wangle/bootstrap/BootstrapTest.cpp +++ b/folly/experimental/wangle/bootstrap/BootstrapTest.cpp @@ -138,6 +138,20 @@ TEST(Bootstrap, ServerAcceptGroupTest) { TEST(Bootstrap, ServerAcceptGroup2Test) { // Verify that server is using the accept IO group + // Check if reuse port is supported, if not, don't run this test + try { + EventBase base; + auto serverSocket = AsyncServerSocket::newSocket(&base); + serverSocket->bind(0); + serverSocket->listen(0); + serverSocket->startAccepting(); + serverSocket->setReusePortEnabled(true); + serverSocket->stopAccepting(); + } catch(...) { + LOG(INFO) << "Reuse port probably not supported"; + return; + } + TestServer server; auto factory = std::make_shared(); server.childPipeline(factory); diff --git a/folly/experimental/wangle/bootstrap/ServerBootstrap.h b/folly/experimental/wangle/bootstrap/ServerBootstrap.h index f7389d98..85edb646 100644 --- a/folly/experimental/wangle/bootstrap/ServerBootstrap.h +++ b/folly/experimental/wangle/bootstrap/ServerBootstrap.h @@ -145,7 +145,7 @@ class ServerBootstrap { } bool reusePort = false; - if (acceptor_group_->numThreads() >= 0) { + if (acceptor_group_->numThreads() > 1) { reusePort = true; } -- 2.34.1