From: Mohammad Husain Date: Mon, 26 Oct 2015 18:56:02 +0000 (-0700) Subject: Rename two callback function names of ConnectionEventCallback X-Git-Tag: deprecate-dynamic-initializer~297 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=22f86ef7dd5148c7b2b08d1b050d2463e70a4f29;p=folly.git Rename two callback function names of ConnectionEventCallback Summary: Renaming `EnqueuedForAccept` and `DequeuedByAccept` to `EnqueuedForAcceptor` and `DequeuedByAcceptor` respectively to make it clear that the connection is queued for the Acceptor not to call `accept` on. Reviewed By: yfeldblum Differential Revision: D2554578 fb-gh-sync-id: 072a9ff122658827d1e89f2bef79ad565dad7974 --- diff --git a/folly/io/async/AsyncServerSocket.cpp b/folly/io/async/AsyncServerSocket.cpp index b2b2d24b..f7a395c0 100644 --- a/folly/io/async/AsyncServerSocket.cpp +++ b/folly/io/async/AsyncServerSocket.cpp @@ -92,7 +92,7 @@ void AsyncServerSocket::RemoteAcceptor::messageAvailable( case MessageType::MSG_NEW_CONN: { if (connectionEventCallback_) { - connectionEventCallback_->onConnectionDequeuedByAcceptCallback( + connectionEventCallback_->onConnectionDequeuedByAcceptorCallback( msg.fd, msg.address); } callback_->connectionAccepted(msg.fd, msg.address); @@ -824,8 +824,9 @@ void AsyncServerSocket::dispatchSocket(int socket, while (true) { if (info->consumer->getQueue()->tryPutMessageNoThrow(std::move(msg))) { if (connectionEventCallback_) { - connectionEventCallback_->onConnectionEnqueuedForAcceptCallback(socket, - addr); + connectionEventCallback_->onConnectionEnqueuedForAcceptorCallback( + socket, + addr); } // Success! return. return; diff --git a/folly/io/async/AsyncServerSocket.h b/folly/io/async/AsyncServerSocket.h index 4f1194f7..9b82ebd5 100644 --- a/folly/io/async/AsyncServerSocket.h +++ b/folly/io/async/AsyncServerSocket.h @@ -95,18 +95,18 @@ class AsyncServerSocket : public DelayedDestruction const SocketAddress& addr) noexcept = 0; /** - * onConnectionEnqueuedForAcceptCallback() is called when the + * onConnectionEnqueuedForAcceptorCallback() is called when the * connection is successfully enqueued for an AcceptCallback to pick up. */ - virtual void onConnectionEnqueuedForAcceptCallback( + virtual void onConnectionEnqueuedForAcceptorCallback( const int socket, const SocketAddress& addr) noexcept = 0; /** - * onConnectionDequeuedByAcceptCallback() is called when the + * onConnectionDequeuedByAcceptorCallback() is called when the * connection is successfully dequeued by an AcceptCallback. */ - virtual void onConnectionDequeuedByAcceptCallback( + virtual void onConnectionDequeuedByAcceptorCallback( const int socket, const SocketAddress& addr) noexcept = 0; diff --git a/folly/io/async/test/AsyncSocketTest2.cpp b/folly/io/async/test/AsyncSocketTest2.cpp index 2c822eef..73295ca3 100644 --- a/folly/io/async/test/AsyncSocketTest2.cpp +++ b/folly/io/async/test/AsyncSocketTest2.cpp @@ -1480,14 +1480,14 @@ class TestConnectionEventCallback : connectionDropped_++; } - virtual void onConnectionEnqueuedForAcceptCallback( + virtual void onConnectionEnqueuedForAcceptorCallback( const int socket, const SocketAddress& addr) noexcept override { folly::RWSpinLock::WriteHolder holder(spinLock_); connectionEnqueuedForAcceptCallback_++; } - virtual void onConnectionDequeuedByAcceptCallback( + virtual void onConnectionDequeuedByAcceptorCallback( const int socket, const SocketAddress& addr) noexcept override { folly::RWSpinLock::WriteHolder holder(spinLock_);