Commit 71b91824 authored by Dave Watson's avatar Dave Watson Committed by Noam Lerner

httpserver on serverbootstrap (2)

Summary:
Original diff D1800100, reverted in D1895181.  Issue seems to have been caused by a copy constructor issue.

Fixes: Remove copy constructor, move contructor only.  Separate stop() and join(), since join() can happen only after all stop()s have completed when reusing the same IOThreadPoolExecutors.

Test Plan: build and unit tests of relevant product

Reviewed By: praveenr@fb.com

Subscribers: trunkagent, doug, fugalh, alandau, bmatheny, mshneer, folly-diffs@, jsedgwick, yfeldblum

FB internal diff: D1901718

Tasks: 6431975

Signature: t1:1901718:1426885577:46b63bfe117df207be3d273b953c100249c1a7da

Blame Revision: D1895181
parent 87a4b661
......@@ -82,11 +82,11 @@ class AsyncUDPServerSocket : private AsyncUDPSocket::ReadCallback
}
}
void bind(const folly::SocketAddress& address) {
void bind(const folly::SocketAddress& addy) {
CHECK(!socket_);
socket_ = folly::make_unique<AsyncUDPSocket>(evb_);
socket_->bind(address);
socket_->bind(addy);
}
folly::SocketAddress address() const {
......
......@@ -42,8 +42,14 @@ template <typename Pipeline>
class ServerBootstrap {
public:
ServerBootstrap(const ServerBootstrap& that) = delete;
ServerBootstrap(ServerBootstrap&& that) = default;
ServerBootstrap() {}
~ServerBootstrap() {
stop();
join();
}
typedef wangle::ChannelPipeline<
......@@ -222,7 +228,7 @@ class ServerBootstrap {
new_sockets.push_back(socket);
sock_lock.unlock();
if (port == 0) {
if (port <= 0) {
socket->getAddress(&address);
port = address.getPort();
}
......@@ -278,7 +284,9 @@ class ServerBootstrap {
barrier.wait();
}
sockets_.clear();
}
void join() {
if (acceptor_group_) {
acceptor_group_->join();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment