Commit c98aec4e authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot 4

Use the socket portability layer when needed.

Summary: This switches the places in Folly that need to explicitly reference the socket portability implementation to do exactly that.

Reviewed By: yfeldblum

Differential Revision: D3299984

fbshipit-source-id: 57cd8ebe66c9055aba66581a8c0fcf6c125d96f9
parent f3d9a55f
...@@ -83,7 +83,7 @@ int flockNoInt(int fd, int operation) { ...@@ -83,7 +83,7 @@ int flockNoInt(int fd, int operation) {
} }
int shutdownNoInt(int fd, int how) { int shutdownNoInt(int fd, int how) {
return wrapNoInt(shutdown, fd, how); return wrapNoInt(portability::sockets::shutdown, fd, how);
} }
ssize_t readNoInt(int fd, void* buf, size_t count) { ssize_t readNoInt(int fd, void* buf, size_t count) {
......
...@@ -240,11 +240,11 @@ void SocketAddress::setFromPath(StringPiece path) { ...@@ -240,11 +240,11 @@ void SocketAddress::setFromPath(StringPiece path) {
} }
} }
void SocketAddress::setFromPeerAddress(SocketDesc socket) { void SocketAddress::setFromPeerAddress(int socket) {
setFromSocket(socket, getpeername); setFromSocket(socket, getpeername);
} }
void SocketAddress::setFromLocalAddress(SocketDesc socket) { void SocketAddress::setFromLocalAddress(int socket) {
setFromSocket(socket, getsockname); setFromSocket(socket, getsockname);
} }
...@@ -644,7 +644,9 @@ void SocketAddress::setFromLocalAddr(const struct addrinfo* info) { ...@@ -644,7 +644,9 @@ void SocketAddress::setFromLocalAddr(const struct addrinfo* info) {
setFromSockaddr(info->ai_addr, info->ai_addrlen); setFromSockaddr(info->ai_addr, info->ai_addrlen);
} }
void SocketAddress::setFromSocket(SocketDesc socket, GetPeerNameFunc fn) { void SocketAddress::setFromSocket(
int socket,
int (*fn)(int, struct sockaddr*, socklen_t*)) {
// Try to put the address into a local storage buffer. // Try to put the address into a local storage buffer.
sockaddr_storage tmp_sock; sockaddr_storage tmp_sock;
socklen_t addrLen = sizeof(tmp_sock); socklen_t addrLen = sizeof(tmp_sock);
......
...@@ -301,22 +301,19 @@ class SocketAddress { ...@@ -301,22 +301,19 @@ class SocketAddress {
setFromPath(StringPiece{path, length}); setFromPath(StringPiece{path, length});
} }
// a typedef that allow us to compile against both winsock & POSIX sockets:
using SocketDesc = decltype(socket(0,0,0)); // POSIX: int, winsock: unsigned
/** /**
* Initialize this SocketAddress from a socket's peer address. * Initialize this SocketAddress from a socket's peer address.
* *
* Raises std::system_error on error. * Raises std::system_error on error.
*/ */
void setFromPeerAddress(SocketDesc socket); void setFromPeerAddress(int socket);
/** /**
* Initialize this SocketAddress from a socket's local address. * Initialize this SocketAddress from a socket's local address.
* *
* Raises std::system_error on error. * Raises std::system_error on error.
*/ */
void setFromLocalAddress(SocketDesc socket); void setFromLocalAddress(int socket);
/** /**
* Initialize this folly::SocketAddress from a struct sockaddr. * Initialize this folly::SocketAddress from a struct sockaddr.
...@@ -572,19 +569,11 @@ class SocketAddress { ...@@ -572,19 +569,11 @@ class SocketAddress {
} }
}; };
// a typedef that allow us to compile against both winsock & POSIX sockets:
// (both arg types and calling conventions differ for both)
// POSIX: void setFromSocket(int socket,
// int(*fn)(int, struct sockaddr*, socklen_t*));
// mingw: void setFromSocket(unsigned socket,
// int(*fn)(unsigned, struct sockaddr*, socklen_t*));
using GetPeerNameFunc = decltype(getpeername);
struct addrinfo* getAddrInfo(const char* host, uint16_t port, int flags); struct addrinfo* getAddrInfo(const char* host, uint16_t port, int flags);
struct addrinfo* getAddrInfo(const char* host, const char* port, int flags); struct addrinfo* getAddrInfo(const char* host, const char* port, int flags);
void setFromAddrInfo(const struct addrinfo* results); void setFromAddrInfo(const struct addrinfo* results);
void setFromLocalAddr(const struct addrinfo* results); void setFromLocalAddr(const struct addrinfo* results);
void setFromSocket(SocketDesc socket, GetPeerNameFunc fn); void setFromSocket(int socket, int (*fn)(int, struct sockaddr*, socklen_t*));
std::string getIpString(int flags) const; std::string getIpString(int flags) const;
void getIpString(char *buf, size_t buflen, int flags) const; void getIpString(char *buf, size_t buflen, int flags) const;
...@@ -612,9 +601,10 @@ class SocketAddress { ...@@ -612,9 +601,10 @@ class SocketAddress {
* If we need to store a Unix socket address, ExternalUnixAddr is a shim to * If we need to store a Unix socket address, ExternalUnixAddr is a shim to
* track a struct sockaddr_un allocated separately on the heap. * track a struct sockaddr_un allocated separately on the heap.
*/ */
union { union AddrStorage {
folly::IPAddress addr{}; folly::IPAddress addr;
ExternalUnixAddr un; ExternalUnixAddr un;
AddrStorage() : addr() {}
} storage_{}; } storage_{};
// IPAddress class does nto save zone or port, and must be saved here // IPAddress class does nto save zone or port, and must be saved here
uint16_t port_; uint16_t port_;
......
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
namespace fsp = folly::portability::sockets;
namespace folly { namespace folly {
const uint32_t AsyncServerSocket::kDefaultMaxAcceptAtOnce; const uint32_t AsyncServerSocket::kDefaultMaxAcceptAtOnce;
...@@ -288,7 +290,7 @@ void AsyncServerSocket::bindSocket( ...@@ -288,7 +290,7 @@ void AsyncServerSocket::bindSocket(
sockaddr_storage addrStorage; sockaddr_storage addrStorage;
address.getAddress(&addrStorage); address.getAddress(&addrStorage);
sockaddr* saddr = reinterpret_cast<sockaddr*>(&addrStorage); sockaddr* saddr = reinterpret_cast<sockaddr*>(&addrStorage);
if (::bind(fd, saddr, address.getActualSize()) != 0) { if (fsp::bind(fd, saddr, address.getActualSize()) != 0) {
if (!isExistingSocket) { if (!isExistingSocket) {
closeNoInt(fd); closeNoInt(fd);
} }
...@@ -370,7 +372,7 @@ void AsyncServerSocket::bind(uint16_t port) { ...@@ -370,7 +372,7 @@ void AsyncServerSocket::bind(uint16_t port) {
SCOPE_EXIT { freeaddrinfo(res0); }; SCOPE_EXIT { freeaddrinfo(res0); };
auto setupAddress = [&] (struct addrinfo* res) { auto setupAddress = [&] (struct addrinfo* res) {
int s = socket(res->ai_family, res->ai_socktype, res->ai_protocol); int s = fsp::socket(res->ai_family, res->ai_socktype, res->ai_protocol);
// IPv6/IPv4 may not be supported by the kernel // IPv6/IPv4 may not be supported by the kernel
if (s < 0 && errno == EAFNOSUPPORT) { if (s < 0 && errno == EAFNOSUPPORT) {
return; return;
...@@ -396,7 +398,7 @@ void AsyncServerSocket::bind(uint16_t port) { ...@@ -396,7 +398,7 @@ void AsyncServerSocket::bind(uint16_t port) {
sockets_.emplace_back(eventBase_, s, this, address.getFamily()); sockets_.emplace_back(eventBase_, s, this, address.getFamily());
// Bind to the socket // Bind to the socket
if (::bind(s, res->ai_addr, res->ai_addrlen) != 0) { if (fsp::bind(s, res->ai_addr, res->ai_addrlen) != 0) {
folly::throwSystemError( folly::throwSystemError(
errno, errno,
"failed to bind to async server socket for port ", "failed to bind to async server socket for port ",
...@@ -475,7 +477,7 @@ void AsyncServerSocket::listen(int backlog) { ...@@ -475,7 +477,7 @@ void AsyncServerSocket::listen(int backlog) {
// Start listening // Start listening
for (auto& handler : sockets_) { for (auto& handler : sockets_) {
if (::listen(handler.socket_, backlog) == -1) { if (fsp::listen(handler.socket_, backlog) == -1) {
folly::throwSystemError(errno, folly::throwSystemError(errno,
"failed to listen on async server socket"); "failed to listen on async server socket");
} }
...@@ -631,7 +633,7 @@ void AsyncServerSocket::pauseAccepting() { ...@@ -631,7 +633,7 @@ void AsyncServerSocket::pauseAccepting() {
} }
int AsyncServerSocket::createSocket(int family) { int AsyncServerSocket::createSocket(int family) {
int fd = socket(family, SOCK_STREAM, 0); int fd = fsp::socket(family, SOCK_STREAM, 0);
if (fd == -1) { if (fd == -1) {
folly::throwSystemError(errno, "error creating async server socket"); folly::throwSystemError(errno, "error creating async server socket");
} }
......
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
using std::string; using std::string;
using std::unique_ptr; using std::unique_ptr;
namespace fsp = folly::portability::sockets;
namespace folly { namespace folly {
// static members initializers // static members initializers
...@@ -335,7 +337,7 @@ void AsyncSocket::connect(ConnectCallback* callback, ...@@ -335,7 +337,7 @@ void AsyncSocket::connect(ConnectCallback* callback,
// constant (PF_xxx) rather than an address family (AF_xxx), but the // constant (PF_xxx) rather than an address family (AF_xxx), but the
// distinction is mainly just historical. In pretty much all // distinction is mainly just historical. In pretty much all
// implementations the PF_foo and AF_foo constants are identical. // implementations the PF_foo and AF_foo constants are identical.
fd_ = socket(address.getFamily(), SOCK_STREAM, 0); fd_ = fsp::socket(address.getFamily(), SOCK_STREAM, 0);
if (fd_ < 0) { if (fd_ < 0) {
auto errnoCopy = errno; auto errnoCopy = errno;
throw AsyncSocketException( throw AsyncSocketException(
...@@ -393,7 +395,7 @@ void AsyncSocket::connect(ConnectCallback* callback, ...@@ -393,7 +395,7 @@ void AsyncSocket::connect(ConnectCallback* callback,
// bind the socket // bind the socket
if (bindAddr != anyAddress()) { if (bindAddr != anyAddress()) {
int one = 1; int one = 1;
if (::setsockopt(fd_, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) { if (setsockopt(fd_, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) {
auto errnoCopy = errno; auto errnoCopy = errno;
doClose(); doClose();
throw AsyncSocketException( throw AsyncSocketException(
...@@ -404,7 +406,7 @@ void AsyncSocket::connect(ConnectCallback* callback, ...@@ -404,7 +406,7 @@ void AsyncSocket::connect(ConnectCallback* callback,
bindAddr.getAddress(&addrStorage); bindAddr.getAddress(&addrStorage);
if (::bind(fd_, saddr, bindAddr.getActualSize()) != 0) { if (bind(fd_, saddr, bindAddr.getActualSize()) != 0) {
auto errnoCopy = errno; auto errnoCopy = errno;
doClose(); doClose();
throw AsyncSocketException( throw AsyncSocketException(
...@@ -1004,7 +1006,7 @@ void AsyncSocket::shutdownWriteNow() { ...@@ -1004,7 +1006,7 @@ void AsyncSocket::shutdownWriteNow() {
} }
// Shutdown writes on the file descriptor // Shutdown writes on the file descriptor
::shutdown(fd_, SHUT_WR); shutdown(fd_, SHUT_WR);
// Immediately fail all write requests // Immediately fail all write requests
failAllWrites(socketShutdownForWritesEx); failAllWrites(socketShutdownForWritesEx);
...@@ -1547,7 +1549,7 @@ void AsyncSocket::handleWrite() noexcept { ...@@ -1547,7 +1549,7 @@ void AsyncSocket::handleWrite() noexcept {
} }
} else { } else {
// Reads are still enabled, so we are only doing a half-shutdown // Reads are still enabled, so we are only doing a half-shutdown
::shutdown(fd_, SHUT_WR); shutdown(fd_, SHUT_WR);
} }
} }
} }
...@@ -1698,7 +1700,7 @@ void AsyncSocket::handleConnect() noexcept { ...@@ -1698,7 +1700,7 @@ void AsyncSocket::handleConnect() noexcept {
// are still connecting we just abort the connect rather than waiting for // are still connecting we just abort the connect rather than waiting for
// it to complete. // it to complete.
assert((shutdownFlags_ & SHUT_READ) == 0); assert((shutdownFlags_ & SHUT_READ) == 0);
::shutdown(fd_, SHUT_WR); shutdown(fd_, SHUT_WR);
shutdownFlags_ |= SHUT_WRITE; shutdownFlags_ |= SHUT_WRITE;
} }
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#define SO_REUSEPORT 15 #define SO_REUSEPORT 15
#endif #endif
namespace fsp = folly::portability::sockets;
namespace folly { namespace folly {
AsyncUDPSocket::AsyncUDPSocket(EventBase* evb) AsyncUDPSocket::AsyncUDPSocket(EventBase* evb)
...@@ -47,7 +49,7 @@ AsyncUDPSocket::~AsyncUDPSocket() { ...@@ -47,7 +49,7 @@ AsyncUDPSocket::~AsyncUDPSocket() {
} }
void AsyncUDPSocket::bind(const folly::SocketAddress& address) { void AsyncUDPSocket::bind(const folly::SocketAddress& address) {
int socket = ::socket(address.getFamily(), SOCK_DGRAM, IPPROTO_UDP); int socket = fsp::socket(address.getFamily(), SOCK_DGRAM, IPPROTO_UDP);
if (socket == -1) { if (socket == -1) {
throw AsyncSocketException(AsyncSocketException::NOT_OPEN, throw AsyncSocketException(AsyncSocketException::NOT_OPEN,
"error creating async udp socket", "error creating async udp socket",
...@@ -97,8 +99,7 @@ void AsyncUDPSocket::bind(const folly::SocketAddress& address) { ...@@ -97,8 +99,7 @@ void AsyncUDPSocket::bind(const folly::SocketAddress& address) {
// If we're using IPv6, make sure we don't accept V4-mapped connections // If we're using IPv6, make sure we don't accept V4-mapped connections
if (address.getFamily() == AF_INET6) { if (address.getFamily() == AF_INET6) {
int flag = 1; int flag = 1;
if (::setsockopt(socket, IPPROTO_IPV6, IPV6_V6ONLY, if (setsockopt(socket, IPPROTO_IPV6, IPV6_V6ONLY, &flag, sizeof(flag))) {
&flag, sizeof(flag))) {
throw AsyncSocketException( throw AsyncSocketException(
AsyncSocketException::NOT_OPEN, AsyncSocketException::NOT_OPEN,
"Failed to set IPV6_V6ONLY", "Failed to set IPV6_V6ONLY",
...@@ -110,7 +111,7 @@ void AsyncUDPSocket::bind(const folly::SocketAddress& address) { ...@@ -110,7 +111,7 @@ void AsyncUDPSocket::bind(const folly::SocketAddress& address) {
sockaddr_storage addrStorage; sockaddr_storage addrStorage;
address.getAddress(&addrStorage); address.getAddress(&addrStorage);
sockaddr* saddr = reinterpret_cast<sockaddr*>(&addrStorage); sockaddr* saddr = reinterpret_cast<sockaddr*>(&addrStorage);
if (::bind(socket, saddr, address.getActualSize()) != 0) { if (fsp::bind(socket, saddr, address.getActualSize()) != 0) {
throw AsyncSocketException( throw AsyncSocketException(
AsyncSocketException::NOT_OPEN, AsyncSocketException::NOT_OPEN,
"failed to bind the async udp socket for:" + address.describe(), "failed to bind the async udp socket for:" + address.describe(),
...@@ -252,7 +253,7 @@ void AsyncUDPSocket::handleRead() noexcept { ...@@ -252,7 +253,7 @@ void AsyncUDPSocket::handleRead() noexcept {
struct sockaddr* rawAddr = reinterpret_cast<sockaddr*>(&addrStorage); struct sockaddr* rawAddr = reinterpret_cast<sockaddr*>(&addrStorage);
rawAddr->sa_family = localAddress_.getFamily(); rawAddr->sa_family = localAddress_.getFamily();
ssize_t bytesRead = ::recvfrom(fd_, buf, len, MSG_TRUNC, rawAddr, &addrLen); ssize_t bytesRead = recvfrom(fd_, buf, len, MSG_TRUNC, rawAddr, &addrLen);
if (bytesRead >= 0) { if (bytesRead >= 0) {
clientAddress_.setFromSockaddr(rawAddr, addrLen); clientAddress_.setFromSockaddr(rawAddr, addrLen);
......
...@@ -207,7 +207,8 @@ class TestServer { ...@@ -207,7 +207,8 @@ class TestServer {
// Create a TestServer. // Create a TestServer.
// This immediately starts listening on an ephemeral port. // This immediately starts listening on an ephemeral port.
explicit TestServer(bool enableTFO = false) : fd_(-1) { explicit TestServer(bool enableTFO = false) : fd_(-1) {
fd_ = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); namespace fsp = folly::portability::sockets;
fd_ = fsp::socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (fd_ < 0) { if (fd_ < 0) {
throw folly::AsyncSocketException( throw folly::AsyncSocketException(
folly::AsyncSocketException::INTERNAL_ERROR, folly::AsyncSocketException::INTERNAL_ERROR,
......
...@@ -51,6 +51,8 @@ using boost::scoped_array; ...@@ -51,6 +51,8 @@ using boost::scoped_array;
using namespace folly; using namespace folly;
using namespace testing; using namespace testing;
namespace fsp = folly::portability::sockets;
class DelayedWrite: public AsyncTimeout { class DelayedWrite: public AsyncTimeout {
public: public:
DelayedWrite(const std::shared_ptr<AsyncSocket>& socket, DelayedWrite(const std::shared_ptr<AsyncSocket>& socket,
...@@ -2079,7 +2081,7 @@ TEST(AsyncSocketTest, ServerExistingSocket) { ...@@ -2079,7 +2081,7 @@ TEST(AsyncSocketTest, ServerExistingSocket) {
// Test creating a socket, and letting AsyncServerSocket bind and listen // Test creating a socket, and letting AsyncServerSocket bind and listen
{ {
// Manually create a socket // Manually create a socket
int fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); int fd = fsp::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
ASSERT_GE(fd, 0); ASSERT_GE(fd, 0);
// Create a server socket // Create a server socket
...@@ -2100,7 +2102,7 @@ TEST(AsyncSocketTest, ServerExistingSocket) { ...@@ -2100,7 +2102,7 @@ TEST(AsyncSocketTest, ServerExistingSocket) {
// then letting AsyncServerSocket listen // then letting AsyncServerSocket listen
{ {
// Manually create a socket // Manually create a socket
int fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); int fd = fsp::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
ASSERT_GE(fd, 0); ASSERT_GE(fd, 0);
// bind // bind
struct sockaddr_in addr; struct sockaddr_in addr;
...@@ -2132,7 +2134,7 @@ TEST(AsyncSocketTest, ServerExistingSocket) { ...@@ -2132,7 +2134,7 @@ TEST(AsyncSocketTest, ServerExistingSocket) {
// then giving it to AsyncServerSocket // then giving it to AsyncServerSocket
{ {
// Manually create a socket // Manually create a socket
int fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); int fd = fsp::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
ASSERT_GE(fd, 0); ASSERT_GE(fd, 0);
// bind // bind
struct sockaddr_in addr; struct sockaddr_in addr;
......
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
using folly::ShutdownSocketSet; using folly::ShutdownSocketSet;
namespace fsp = folly::portability::sockets;
namespace folly { namespace test { namespace folly { namespace test {
ShutdownSocketSet shutdownSocketSet; ShutdownSocketSet shutdownSocketSet;
...@@ -56,7 +58,7 @@ Server::Server() ...@@ -56,7 +58,7 @@ Server::Server()
: acceptSocket_(-1), : acceptSocket_(-1),
port_(0), port_(0),
stop_(NO_STOP) { stop_(NO_STOP) {
acceptSocket_ = socket(PF_INET, SOCK_STREAM, 0); acceptSocket_ = fsp::socket(PF_INET, SOCK_STREAM, 0);
CHECK_ERR(acceptSocket_); CHECK_ERR(acceptSocket_);
shutdownSocketSet.add(acceptSocket_); shutdownSocketSet.add(acceptSocket_);
...@@ -130,7 +132,7 @@ void Server::join() { ...@@ -130,7 +132,7 @@ void Server::join() {
} }
int createConnectedSocket(int port) { int createConnectedSocket(int port) {
int sock = socket(PF_INET, SOCK_STREAM, 0); int sock = fsp::socket(PF_INET, SOCK_STREAM, 0);
CHECK_ERR(sock); CHECK_ERR(sock);
sockaddr_in addr; sockaddr_in addr;
addr.sin_family = AF_INET; addr.sin_family = AF_INET;
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#include <sstream> #include <sstream>
#include <system_error> #include <system_error>
#include <folly/portability/Sockets.h>
#include <folly/portability/Stdlib.h>
#include <folly/test/SocketAddressTestHelper.h> #include <folly/test/SocketAddressTestHelper.h>
using namespace boost; using namespace boost;
...@@ -30,6 +32,8 @@ using std::endl; ...@@ -30,6 +32,8 @@ using std::endl;
using folly::SocketAddress; using folly::SocketAddress;
using folly::SocketAddressTestHelper; using folly::SocketAddressTestHelper;
namespace fsp = folly::portability::sockets;
TEST(SocketAddress, Size) { TEST(SocketAddress, Size) {
SocketAddress addr; SocketAddress addr;
EXPECT_EQ(sizeof(addr), 32); EXPECT_EQ(sizeof(addr), 32);
...@@ -663,7 +667,7 @@ void testSetFromSocket(const SocketAddress *serverBindAddr, ...@@ -663,7 +667,7 @@ void testSetFromSocket(const SocketAddress *serverBindAddr,
SocketAddress *serverPeerAddrRet, SocketAddress *serverPeerAddrRet,
SocketAddress *clientAddrRet, SocketAddress *clientAddrRet,
SocketAddress *clientPeerAddrRet) { SocketAddress *clientPeerAddrRet) {
int listenSock = socket(serverBindAddr->getFamily(), SOCK_STREAM, 0); int listenSock = fsp::socket(serverBindAddr->getFamily(), SOCK_STREAM, 0);
REQUIRE_ERRNO(listenSock > 0, "failed to create listen socket"); REQUIRE_ERRNO(listenSock > 0, "failed to create listen socket");
sockaddr_storage laddr; sockaddr_storage laddr;
serverBindAddr->getAddress(&laddr); serverBindAddr->getAddress(&laddr);
...@@ -681,7 +685,7 @@ void testSetFromSocket(const SocketAddress *serverBindAddr, ...@@ -681,7 +685,7 @@ void testSetFromSocket(const SocketAddress *serverBindAddr,
// Note that we use the family from serverBindAddr here, since we allow // Note that we use the family from serverBindAddr here, since we allow
// clientBindAddr to be nullptr. // clientBindAddr to be nullptr.
int clientSock = socket(serverBindAddr->getFamily(), SOCK_STREAM, 0); int clientSock = fsp::socket(serverBindAddr->getFamily(), SOCK_STREAM, 0);
REQUIRE_ERRNO(clientSock > 0, "failed to create client socket"); REQUIRE_ERRNO(clientSock > 0, "failed to create client socket");
if (clientBindAddr != nullptr) { if (clientBindAddr != nullptr) {
sockaddr_storage clientAddr; sockaddr_storage clientAddr;
......
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