Skip to content

Commit

Permalink
AsyncServerSocket::AcceptCallback::connectionAccepted to NetworkSocke…
Browse files Browse the repository at this point in the history
…t (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
  • Loading branch information
Orvid authored and facebook-github-bot committed Apr 10, 2019
1 parent f75287f commit 3c6096c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
7 changes: 1 addition & 6 deletions folly/io/async/AsyncServerSocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,8 @@ class AsyncServerSocket : public DelayedDestruction, public AsyncSocketBase {
* remain valid until connectionAccepted() returns.
*/
virtual void connectionAccepted(
int fd,
const SocketAddress& clientAddr) noexcept = 0;
void connectionAccepted(
NetworkSocket fd,
const SocketAddress& clientAddr) noexcept {
connectionAccepted(fd.toFd(), clientAddr);
}
const SocketAddress& clientAddr) noexcept = 0;

/**
* acceptError() is called if an error occurs while accepting.
Expand Down
6 changes: 3 additions & 3 deletions folly/io/async/test/AsyncSocketTest2.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,12 @@ class TestAcceptCallback : public AsyncServerSocket::AcceptCallback {
}

void connectionAccepted(
int fd,
NetworkSocket fd,
const folly::SocketAddress& clientAddr) noexcept override {
events_.emplace_back(NetworkSocket::fromFd(fd), clientAddr);
events_.emplace_back(fd, clientAddr);

if (connectionAcceptedFn_) {
connectionAcceptedFn_(NetworkSocket::fromFd(fd), clientAddr);
connectionAcceptedFn_(fd, clientAddr);
}
}
void acceptError(const std::exception& ex) noexcept override {
Expand Down
4 changes: 3 additions & 1 deletion folly/io/async/test/TestSSLServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ class SSLServerAcceptCallbackBase : public AsyncServerSocket::AcceptCallback {
}

void connectionAccepted(
int fd,
folly::NetworkSocket fdNetworkSocket,
const SocketAddress& /* clientAddr */) noexcept override {
int fd = fdNetworkSocket.toFd();

if (socket_) {
socket_->detachEventBase();
}
Expand Down
4 changes: 3 additions & 1 deletion folly/io/async/test/ZeroCopy.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,10 @@ class ZeroCopyTestServer : public folly::AsyncServerSocket::AcceptCallback {
}

void connectionAccepted(
int fd,
folly::NetworkSocket fdNetworkSocket,
const folly::SocketAddress& /* unused */) noexcept override {
int fd = fdNetworkSocket.toFd();

auto client = std::make_shared<ZeroCopyTestAsyncSocket>(
nullptr,
evb_,
Expand Down

0 comments on commit 3c6096c

Please sign in to comment.