Commit 3c6096c2 authored by Orvid King's avatar Orvid King Committed by Facebook Github Bot

AsyncServerSocket::AcceptCallback::connectionAccepted to NetworkSocket (attempt #2)

Summary:
The file descriptor API here needs to go away, so switch this API to NetworkSocket

It is expected that this commit will cause a number of Open Source projects to temporarily show up as broken. This is due to the fact that not all projects get synced to Github at the exact same time, so the builds may temporarily be fetching an older version of it's dependencies than it needs to :) It should fix itself quickly.

Reviewed By: yfeldblum

Differential Revision: D14673328

fbshipit-source-id: c5842fa5dc383d50043e0d8228e35d03b10a1c6b
parent f75287f2
...@@ -158,13 +158,8 @@ class AsyncServerSocket : public DelayedDestruction, public AsyncSocketBase { ...@@ -158,13 +158,8 @@ class AsyncServerSocket : public DelayedDestruction, public AsyncSocketBase {
* remain valid until connectionAccepted() returns. * remain valid until connectionAccepted() returns.
*/ */
virtual void connectionAccepted( virtual void connectionAccepted(
int fd,
const SocketAddress& clientAddr) noexcept = 0;
void connectionAccepted(
NetworkSocket fd, NetworkSocket fd,
const SocketAddress& clientAddr) noexcept { const SocketAddress& clientAddr) noexcept = 0;
connectionAccepted(fd.toFd(), clientAddr);
}
/** /**
* acceptError() is called if an error occurs while accepting. * acceptError() is called if an error occurs while accepting.
......
...@@ -182,12 +182,12 @@ class TestAcceptCallback : public AsyncServerSocket::AcceptCallback { ...@@ -182,12 +182,12 @@ class TestAcceptCallback : public AsyncServerSocket::AcceptCallback {
} }
void connectionAccepted( void connectionAccepted(
int fd, NetworkSocket fd,
const folly::SocketAddress& clientAddr) noexcept override { const folly::SocketAddress& clientAddr) noexcept override {
events_.emplace_back(NetworkSocket::fromFd(fd), clientAddr); events_.emplace_back(fd, clientAddr);
if (connectionAcceptedFn_) { if (connectionAcceptedFn_) {
connectionAcceptedFn_(NetworkSocket::fromFd(fd), clientAddr); connectionAcceptedFn_(fd, clientAddr);
} }
} }
void acceptError(const std::exception& ex) noexcept override { void acceptError(const std::exception& ex) noexcept override {
......
...@@ -61,8 +61,10 @@ class SSLServerAcceptCallbackBase : public AsyncServerSocket::AcceptCallback { ...@@ -61,8 +61,10 @@ class SSLServerAcceptCallbackBase : public AsyncServerSocket::AcceptCallback {
} }
void connectionAccepted( void connectionAccepted(
int fd, folly::NetworkSocket fdNetworkSocket,
const SocketAddress& /* clientAddr */) noexcept override { const SocketAddress& /* clientAddr */) noexcept override {
int fd = fdNetworkSocket.toFd();
if (socket_) { if (socket_) {
socket_->detachEventBase(); socket_->detachEventBase();
} }
......
...@@ -227,8 +227,10 @@ class ZeroCopyTestServer : public folly::AsyncServerSocket::AcceptCallback { ...@@ -227,8 +227,10 @@ class ZeroCopyTestServer : public folly::AsyncServerSocket::AcceptCallback {
} }
void connectionAccepted( void connectionAccepted(
int fd, folly::NetworkSocket fdNetworkSocket,
const folly::SocketAddress& /* unused */) noexcept override { const folly::SocketAddress& /* unused */) noexcept override {
int fd = fdNetworkSocket.toFd();
auto client = std::make_shared<ZeroCopyTestAsyncSocket>( auto client = std::make_shared<ZeroCopyTestAsyncSocket>(
nullptr, nullptr,
evb_, evb_,
......
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