From: Neel Goyal Date: Tue, 1 Aug 2017 15:37:13 +0000 (-0700) Subject: Change AsyncUDP's readCallback to be protected. X-Git-Tag: v2017.08.07.00~13 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=432d60d63348ad14320d13eca91e5f9b37d3c96b;p=folly.git Change AsyncUDP's readCallback to be protected. Summary: Change AsyncUDPSocket's ReadCallback to be protected so that subclasses can have access to it. Reviewed By: yangchi Differential Revision: D5376012 fbshipit-source-id: 7ec21d9bfe6bde525253adea7abf5dea15fb7fa0 --- diff --git a/folly/io/async/AsyncUDPSocket.cpp b/folly/io/async/AsyncUDPSocket.cpp index 6f46c011..7f5cd5f9 100644 --- a/folly/io/async/AsyncUDPSocket.cpp +++ b/folly/io/async/AsyncUDPSocket.cpp @@ -36,9 +36,9 @@ namespace folly { AsyncUDPSocket::AsyncUDPSocket(EventBase* evb) : EventHandler(CHECK_NOTNULL(evb)), + readCallback_(nullptr), eventBase_(evb), - fd_(-1), - readCallback_(nullptr) { + fd_(-1) { evb->dcheckIsInEventBaseThread(); } diff --git a/folly/io/async/AsyncUDPSocket.h b/folly/io/async/AsyncUDPSocket.h index 6d49ed67..2166eb0f 100644 --- a/folly/io/async/AsyncUDPSocket.h +++ b/folly/io/async/AsyncUDPSocket.h @@ -167,6 +167,9 @@ class AsyncUDPSocket : public EventHandler { return ::sendmsg(socket, message, flags); } + // Non-null only when we are reading + ReadCallback* readCallback_; + private: AsyncUDPSocket(const AsyncUDPSocket&) = delete; AsyncUDPSocket& operator=(const AsyncUDPSocket&) = delete; @@ -186,9 +189,6 @@ class AsyncUDPSocket : public EventHandler { // Temp space to receive client address folly::SocketAddress clientAddress_; - // Non-null only when we are reading - ReadCallback* readCallback_; - bool reuseAddr_{true}; bool reusePort_{false}; };