From 22f86ef7dd5148c7b2b08d1b050d2463e70a4f29 Mon Sep 17 00:00:00 2001 From: Mohammad Husain Date: Mon, 26 Oct 2015 11:56:02 -0700 Subject: [PATCH] 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 --- folly/io/async/AsyncServerSocket.cpp | 7 ++++--- folly/io/async/AsyncServerSocket.h | 8 ++++---- folly/io/async/test/AsyncSocketTest2.cpp | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) 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_); -- 2.34.1