Skip to content

Commit

Permalink
Wasm folly io/net compilation fixes
Browse files Browse the repository at this point in the history
Summary: We have a wasm project compilation broken. This is one of the required fixes. It normalizes types for emcc.

Reviewed By: EricGriffith

Differential Revision: D40398649

fbshipit-source-id: ee67bf0eb840a24aec9f8b9f9c56ae4d282b6ac8
  • Loading branch information
rudybear authored and facebook-github-bot committed Oct 23, 2022
1 parent 352c7ce commit de84911
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
3 changes: 0 additions & 3 deletions folly/net/NetworkSocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ struct NetworkSocket {
#ifdef _WIN32
using native_handle_type = SOCKET;
static constexpr native_handle_type invalid_handle_value = INVALID_SOCKET;
#elif defined(__EMSCRIPTEN__)
using native_handle_type = void*;
static constexpr native_handle_type invalid_handle_value = nullptr;
#else
using native_handle_type = int;
static constexpr native_handle_type invalid_handle_value = -1;
Expand Down
8 changes: 2 additions & 6 deletions folly/net/detail/SocketFileDescriptorMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,11 @@ int SocketFileDescriptorMap::close(int fd) noexcept {
std::terminate();
}

int SocketFileDescriptorMap::close(void* sock) noexcept {
int SocketFileDescriptorMap::fdToSocket(int fd) noexcept {
std::terminate();
}

void* SocketFileDescriptorMap::fdToSocket(int fd) noexcept {
std::terminate();
}

int SocketFileDescriptorMap::socketToFd(void* sock) noexcept {
int SocketFileDescriptorMap::socketToFd(int sock) noexcept {
std::terminate();
}

Expand Down
5 changes: 2 additions & 3 deletions folly/net/detail/SocketFileDescriptorMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ struct SocketFileDescriptorMap {
static int socketToFd(SOCKET sock) noexcept;
#elif defined(__EMSCRIPTEN__)
static int close(int fd) noexcept;
static int close(void* sock) noexcept;

static void* fdToSocket(int fd) noexcept;
static int socketToFd(void* sock) noexcept;
static int fdToSocket(int fd) noexcept;
static int socketToFd(int sock) noexcept;
#else
static int close(int fd) noexcept { return ::close(fd); }

Expand Down

0 comments on commit de84911

Please sign in to comment.