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

Shift AsyncSSLSocketTest to use NetworkSocket

Summary: Do it.

Reviewed By: yfeldblum

Differential Revision: D12988464

fbshipit-source-id: b5dd907f24f9064ea7c7e417e0616120339eb452
parent 1d27782a
...@@ -22,10 +22,11 @@ ...@@ -22,10 +22,11 @@
#include <folly/io/async/AsyncSSLSocket.h> #include <folly/io/async/AsyncSSLSocket.h>
#include <folly/io/async/EventBase.h> #include <folly/io/async/EventBase.h>
#include <folly/io/async/ScopedEventBaseThread.h> #include <folly/io/async/ScopedEventBaseThread.h>
#include <folly/net/NetOps.h>
#include <folly/net/NetworkSocket.h>
#include <folly/portability/GMock.h> #include <folly/portability/GMock.h>
#include <folly/portability/GTest.h> #include <folly/portability/GTest.h>
#include <folly/portability/OpenSSL.h> #include <folly/portability/OpenSSL.h>
#include <folly/portability/Sockets.h>
#include <folly/portability/Unistd.h> #include <folly/portability/Unistd.h>
#include <folly/ssl/Init.h> #include <folly/ssl/Init.h>
...@@ -111,17 +112,12 @@ uint32_t TestSSLAsyncCacheServer::lookupDelay_ = 0; ...@@ -111,17 +112,12 @@ uint32_t TestSSLAsyncCacheServer::lookupDelay_ = 0;
constexpr size_t SSLClient::kMaxReadBufferSz; constexpr size_t SSLClient::kMaxReadBufferSz;
constexpr size_t SSLClient::kMaxReadsPerEvent; constexpr size_t SSLClient::kMaxReadsPerEvent;
void getfds(int fds[2]) { void getfds(NetworkSocket fds[2]) {
if (socketpair(PF_LOCAL, SOCK_STREAM, 0, fds) != 0) { if (netops::socketpair(PF_LOCAL, SOCK_STREAM, 0, fds) != 0) {
FAIL() << "failed to create socketpair: " << errnoStr(errno); FAIL() << "failed to create socketpair: " << errnoStr(errno);
} }
for (int idx = 0; idx < 2; ++idx) { for (int idx = 0; idx < 2; ++idx) {
int flags = fcntl(fds[idx], F_GETFL, 0); if (netops::set_socket_non_blocking(fds[idx]) != 0) {
if (flags == -1) {
FAIL() << "failed to get flags for socket " << idx << ": "
<< errnoStr(errno);
}
if (fcntl(fds[idx], F_SETFL, flags | O_NONBLOCK) != 0) {
FAIL() << "failed to put socket " << idx FAIL() << "failed to put socket " << idx
<< " in non-blocking mode: " << errnoStr(errno); << " in non-blocking mode: " << errnoStr(errno);
} }
...@@ -144,7 +140,7 @@ void sslsocketpair( ...@@ -144,7 +140,7 @@ void sslsocketpair(
AsyncSSLSocket::UniquePtr* serverSock) { AsyncSSLSocket::UniquePtr* serverSock) {
auto clientCtx = std::make_shared<folly::SSLContext>(); auto clientCtx = std::make_shared<folly::SSLContext>();
auto serverCtx = std::make_shared<folly::SSLContext>(); auto serverCtx = std::make_shared<folly::SSLContext>();
int fds[2]; NetworkSocket fds[2];
getfds(fds); getfds(fds);
getctx(clientCtx, serverCtx); getctx(clientCtx, serverCtx);
clientSock->reset(new AsyncSSLSocket(clientCtx, eventBase, fds[0], false)); clientSock->reset(new AsyncSSLSocket(clientCtx, eventBase, fds[0], false));
...@@ -258,7 +254,7 @@ TEST(AsyncSSLSocketTest, Renegotiate) { ...@@ -258,7 +254,7 @@ TEST(AsyncSSLSocketTest, Renegotiate) {
EventBase eventBase; EventBase eventBase;
auto clientCtx = std::make_shared<SSLContext>(); auto clientCtx = std::make_shared<SSLContext>();
auto dfServerCtx = std::make_shared<SSLContext>(); auto dfServerCtx = std::make_shared<SSLContext>();
std::array<int, 2> fds; std::array<NetworkSocket, 2> fds;
getfds(fds.data()); getfds(fds.data());
getctx(clientCtx, dfServerCtx); getctx(clientCtx, dfServerCtx);
...@@ -495,7 +491,7 @@ class NextProtocolTest : public Test { ...@@ -495,7 +491,7 @@ class NextProtocolTest : public Test {
EventBase eventBase; EventBase eventBase;
std::shared_ptr<SSLContext> clientCtx{std::make_shared<SSLContext>()}; std::shared_ptr<SSLContext> clientCtx{std::make_shared<SSLContext>()};
std::shared_ptr<SSLContext> serverCtx{std::make_shared<SSLContext>()}; std::shared_ptr<SSLContext> serverCtx{std::make_shared<SSLContext>()};
int fds[2]; NetworkSocket fds[2];
std::unique_ptr<AlpnClient> client; std::unique_ptr<AlpnClient> client;
std::unique_ptr<AlpnServer> server; std::unique_ptr<AlpnServer> server;
}; };
...@@ -568,7 +564,7 @@ TEST(AsyncSSLSocketTest, SNITestMatch) { ...@@ -568,7 +564,7 @@ TEST(AsyncSSLSocketTest, SNITestMatch) {
// tlsext_hostname match. // tlsext_hostname match.
std::shared_ptr<SSLContext> hskServerCtx(dfServerCtx); std::shared_ptr<SSLContext> hskServerCtx(dfServerCtx);
const std::string serverName("xyz.newdev.facebook.com"); const std::string serverName("xyz.newdev.facebook.com");
int fds[2]; NetworkSocket fds[2];
getfds(fds); getfds(fds);
getctx(clientCtx, dfServerCtx); getctx(clientCtx, dfServerCtx);
...@@ -602,7 +598,7 @@ TEST(AsyncSSLSocketTest, SNITestNotMatch) { ...@@ -602,7 +598,7 @@ TEST(AsyncSSLSocketTest, SNITestNotMatch) {
const std::string clientRequestingServerName("foo.com"); const std::string clientRequestingServerName("foo.com");
const std::string serverExpectedServerName("xyz.newdev.facebook.com"); const std::string serverExpectedServerName("xyz.newdev.facebook.com");
int fds[2]; NetworkSocket fds[2];
getfds(fds); getfds(fds);
getctx(clientCtx, dfServerCtx); getctx(clientCtx, dfServerCtx);
...@@ -636,7 +632,7 @@ TEST(AsyncSSLSocketTest, SNITestChangeServerName) { ...@@ -636,7 +632,7 @@ TEST(AsyncSSLSocketTest, SNITestChangeServerName) {
// tlsext_hostname match. // tlsext_hostname match.
std::shared_ptr<SSLContext> hskServerCtx(dfServerCtx); std::shared_ptr<SSLContext> hskServerCtx(dfServerCtx);
const std::string serverName("xyz.newdev.facebook.com"); const std::string serverName("xyz.newdev.facebook.com");
int fds[2]; NetworkSocket fds[2];
getfds(fds); getfds(fds);
getctx(clientCtx, dfServerCtx); getctx(clientCtx, dfServerCtx);
...@@ -669,7 +665,7 @@ TEST(AsyncSSLSocketTest, SNITestClientHelloNoHostname) { ...@@ -669,7 +665,7 @@ TEST(AsyncSSLSocketTest, SNITestClientHelloNoHostname) {
std::shared_ptr<SSLContext> hskServerCtx(dfServerCtx); std::shared_ptr<SSLContext> hskServerCtx(dfServerCtx);
const std::string serverExpectedServerName("xyz.newdev.facebook.com"); const std::string serverExpectedServerName("xyz.newdev.facebook.com");
int fds[2]; NetworkSocket fds[2];
getfds(fds); getfds(fds);
getctx(clientCtx, dfServerCtx); getctx(clientCtx, dfServerCtx);
...@@ -915,7 +911,7 @@ TEST(AsyncSSLSocketTest, SSLParseClientHelloSuccess) { ...@@ -915,7 +911,7 @@ TEST(AsyncSSLSocketTest, SSLParseClientHelloSuccess) {
clientCtx->loadCertificate(kTestCert); clientCtx->loadCertificate(kTestCert);
clientCtx->loadTrustedCertificates(kTestCA); clientCtx->loadTrustedCertificates(kTestCA);
int fds[2]; NetworkSocket fds[2];
getfds(fds); getfds(fds);
AsyncSSLSocket::UniquePtr clientSock( AsyncSSLSocket::UniquePtr clientSock(
...@@ -962,7 +958,7 @@ TEST(AsyncSSLSocketTest, GetClientCertificate) { ...@@ -962,7 +958,7 @@ TEST(AsyncSSLSocketTest, GetClientCertificate) {
clientCtx->loadCertificate(kClientTestCert); clientCtx->loadCertificate(kClientTestCert);
clientCtx->loadTrustedCertificates(kTestCA); clientCtx->loadTrustedCertificates(kTestCA);
std::array<int, 2> fds; std::array<NetworkSocket, 2> fds;
getfds(fds.data()); getfds(fds.data());
AsyncSSLSocket::UniquePtr clientSock( AsyncSSLSocket::UniquePtr clientSock(
...@@ -999,7 +995,7 @@ TEST(AsyncSSLSocketTest, SSLParseClientHelloOnePacket) { ...@@ -999,7 +995,7 @@ TEST(AsyncSSLSocketTest, SSLParseClientHelloOnePacket) {
EventBase eventBase; EventBase eventBase;
auto ctx = std::make_shared<SSLContext>(); auto ctx = std::make_shared<SSLContext>();
int fds[2]; NetworkSocket fds[2];
getfds(fds); getfds(fds);
int bufLen = 42; int bufLen = 42;
...@@ -1041,7 +1037,7 @@ TEST(AsyncSSLSocketTest, SSLParseClientHelloTwoPackets) { ...@@ -1041,7 +1037,7 @@ TEST(AsyncSSLSocketTest, SSLParseClientHelloTwoPackets) {
EventBase eventBase; EventBase eventBase;
auto ctx = std::make_shared<SSLContext>(); auto ctx = std::make_shared<SSLContext>();
int fds[2]; NetworkSocket fds[2];
getfds(fds); getfds(fds);
int bufLen = 42; int bufLen = 42;
...@@ -1100,7 +1096,7 @@ TEST(AsyncSSLSocketTest, SSLParseClientHelloMultiplePackets) { ...@@ -1100,7 +1096,7 @@ TEST(AsyncSSLSocketTest, SSLParseClientHelloMultiplePackets) {
EventBase eventBase; EventBase eventBase;
auto ctx = std::make_shared<SSLContext>(); auto ctx = std::make_shared<SSLContext>();
int fds[2]; NetworkSocket fds[2];
getfds(fds); getfds(fds);
int bufLen = 42; int bufLen = 42;
...@@ -1156,7 +1152,7 @@ TEST(AsyncSSLSocketTest, SSLHandshakeValidationSuccess) { ...@@ -1156,7 +1152,7 @@ TEST(AsyncSSLSocketTest, SSLHandshakeValidationSuccess) {
auto clientCtx = std::make_shared<SSLContext>(); auto clientCtx = std::make_shared<SSLContext>();
auto dfServerCtx = std::make_shared<SSLContext>(); auto dfServerCtx = std::make_shared<SSLContext>();
int fds[2]; NetworkSocket fds[2];
getfds(fds); getfds(fds);
getctx(clientCtx, dfServerCtx); getctx(clientCtx, dfServerCtx);
...@@ -1194,7 +1190,7 @@ TEST(AsyncSSLSocketTest, SSLHandshakeValidationFailure) { ...@@ -1194,7 +1190,7 @@ TEST(AsyncSSLSocketTest, SSLHandshakeValidationFailure) {
auto clientCtx = std::make_shared<SSLContext>(); auto clientCtx = std::make_shared<SSLContext>();
auto dfServerCtx = std::make_shared<SSLContext>(); auto dfServerCtx = std::make_shared<SSLContext>();
int fds[2]; NetworkSocket fds[2];
getfds(fds); getfds(fds);
getctx(clientCtx, dfServerCtx); getctx(clientCtx, dfServerCtx);
...@@ -1234,7 +1230,7 @@ TEST(AsyncSSLSocketTest, OverrideSSLCtxDisableVerify) { ...@@ -1234,7 +1230,7 @@ TEST(AsyncSSLSocketTest, OverrideSSLCtxDisableVerify) {
auto clientCtx = std::make_shared<SSLContext>(); auto clientCtx = std::make_shared<SSLContext>();
auto dfServerCtx = std::make_shared<SSLContext>(); auto dfServerCtx = std::make_shared<SSLContext>();
int fds[2]; NetworkSocket fds[2];
getfds(fds); getfds(fds);
getctx(clientCtx, dfServerCtx); getctx(clientCtx, dfServerCtx);
...@@ -1285,7 +1281,7 @@ TEST(AsyncSSLSocketTest, OverrideSSLCtxEnableVerify) { ...@@ -1285,7 +1281,7 @@ TEST(AsyncSSLSocketTest, OverrideSSLCtxEnableVerify) {
clientCtx->loadCertificate(kTestCert); clientCtx->loadCertificate(kTestCert);
clientCtx->loadTrustedCertificates(kTestCA); clientCtx->loadTrustedCertificates(kTestCA);
int fds[2]; NetworkSocket fds[2];
getfds(fds); getfds(fds);
AsyncSSLSocket::UniquePtr clientSock( AsyncSSLSocket::UniquePtr clientSock(
...@@ -1317,7 +1313,7 @@ TEST(AsyncSSLSocketTest, SSLHandshakeValidationOverride) { ...@@ -1317,7 +1313,7 @@ TEST(AsyncSSLSocketTest, SSLHandshakeValidationOverride) {
auto clientCtx = std::make_shared<SSLContext>(); auto clientCtx = std::make_shared<SSLContext>();
auto dfServerCtx = std::make_shared<SSLContext>(); auto dfServerCtx = std::make_shared<SSLContext>();
int fds[2]; NetworkSocket fds[2];
getfds(fds); getfds(fds);
getctx(clientCtx, dfServerCtx); getctx(clientCtx, dfServerCtx);
...@@ -1354,7 +1350,7 @@ TEST(AsyncSSLSocketTest, SSLHandshakeValidationSkip) { ...@@ -1354,7 +1350,7 @@ TEST(AsyncSSLSocketTest, SSLHandshakeValidationSkip) {
auto clientCtx = std::make_shared<SSLContext>(); auto clientCtx = std::make_shared<SSLContext>();
auto dfServerCtx = std::make_shared<SSLContext>(); auto dfServerCtx = std::make_shared<SSLContext>();
int fds[2]; NetworkSocket fds[2];
getfds(fds); getfds(fds);
getctx(clientCtx, dfServerCtx); getctx(clientCtx, dfServerCtx);
...@@ -1402,7 +1398,7 @@ TEST(AsyncSSLSocketTest, ClientCertHandshakeSuccess) { ...@@ -1402,7 +1398,7 @@ TEST(AsyncSSLSocketTest, ClientCertHandshakeSuccess) {
clientCtx->loadCertificate(kTestCert); clientCtx->loadCertificate(kTestCert);
clientCtx->loadTrustedCertificates(kTestCA); clientCtx->loadTrustedCertificates(kTestCA);
int fds[2]; NetworkSocket fds[2];
getfds(fds); getfds(fds);
AsyncSSLSocket::UniquePtr clientSock( AsyncSSLSocket::UniquePtr clientSock(
...@@ -1459,7 +1455,7 @@ TEST(AsyncSSLSocketTest, NoClientCertHandshakeError) { ...@@ -1459,7 +1455,7 @@ TEST(AsyncSSLSocketTest, NoClientCertHandshakeError) {
clientCtx->setVerificationOption(SSLContext::SSLVerifyPeerEnum::NO_VERIFY); clientCtx->setVerificationOption(SSLContext::SSLVerifyPeerEnum::NO_VERIFY);
clientCtx->ciphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"); clientCtx->ciphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
int fds[2]; NetworkSocket fds[2];
getfds(fds); getfds(fds);
AsyncSSLSocket::UniquePtr clientSock( AsyncSSLSocket::UniquePtr clientSock(
...@@ -1684,7 +1680,7 @@ TEST(AsyncSSLSocketTest, OpenSSL110AsyncTest) { ...@@ -1684,7 +1680,7 @@ TEST(AsyncSSLSocketTest, OpenSSL110AsyncTest) {
clientCtx->setVerificationOption(SSLContext::SSLVerifyPeerEnum::NO_VERIFY); clientCtx->setVerificationOption(SSLContext::SSLVerifyPeerEnum::NO_VERIFY);
clientCtx->ciphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"); clientCtx->ciphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
int fds[2]; NetworkSocket fds[2];
getfds(fds); getfds(fds);
AsyncSSLSocket::UniquePtr clientSock( AsyncSSLSocket::UniquePtr clientSock(
...@@ -1722,7 +1718,7 @@ TEST(AsyncSSLSocketTest, OpenSSL110AsyncTestFailure) { ...@@ -1722,7 +1718,7 @@ TEST(AsyncSSLSocketTest, OpenSSL110AsyncTestFailure) {
clientCtx->setVerificationOption(SSLContext::SSLVerifyPeerEnum::NO_VERIFY); clientCtx->setVerificationOption(SSLContext::SSLVerifyPeerEnum::NO_VERIFY);
clientCtx->ciphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"); clientCtx->ciphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
int fds[2]; NetworkSocket fds[2];
getfds(fds); getfds(fds);
AsyncSSLSocket::UniquePtr clientSock( AsyncSSLSocket::UniquePtr clientSock(
...@@ -1761,7 +1757,7 @@ TEST(AsyncSSLSocketTest, OpenSSL110AsyncTestClosedWithCallbackPending) { ...@@ -1761,7 +1757,7 @@ TEST(AsyncSSLSocketTest, OpenSSL110AsyncTestClosedWithCallbackPending) {
clientCtx->setVerificationOption(SSLContext::SSLVerifyPeerEnum::NO_VERIFY); clientCtx->setVerificationOption(SSLContext::SSLVerifyPeerEnum::NO_VERIFY);
clientCtx->ciphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"); clientCtx->ciphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
int fds[2]; NetworkSocket fds[2];
getfds(fds); getfds(fds);
AsyncSSLSocket::UniquePtr clientSock( AsyncSSLSocket::UniquePtr clientSock(
...@@ -1875,7 +1871,7 @@ TEST(AsyncSSLSocketTest, UnencryptedTest) { ...@@ -1875,7 +1871,7 @@ TEST(AsyncSSLSocketTest, UnencryptedTest) {
auto clientCtx = std::make_shared<folly::SSLContext>(); auto clientCtx = std::make_shared<folly::SSLContext>();
auto serverCtx = std::make_shared<folly::SSLContext>(); auto serverCtx = std::make_shared<folly::SSLContext>();
int fds[2]; NetworkSocket fds[2];
getfds(fds); getfds(fds);
getctx(clientCtx, serverCtx); getctx(clientCtx, serverCtx);
auto client = auto client =
...@@ -1892,7 +1888,7 @@ TEST(AsyncSSLSocketTest, UnencryptedTest) { ...@@ -1892,7 +1888,7 @@ TEST(AsyncSSLSocketTest, UnencryptedTest) {
// Check that bytes are unencrypted // Check that bytes are unencrypted
char c; char c;
EXPECT_EQ(1, recv(fds[1], &c, 1, MSG_PEEK)); EXPECT_EQ(1, netops::recv(fds[1], &c, 1, MSG_PEEK));
EXPECT_EQ('a', c); EXPECT_EQ('a', c);
EventBaseAborter eba(&base, 3000); EventBaseAborter eba(&base, 3000);
...@@ -1913,7 +1909,7 @@ TEST(AsyncSSLSocketTest, UnencryptedTest) { ...@@ -1913,7 +1909,7 @@ TEST(AsyncSSLSocketTest, UnencryptedTest) {
// Check that bytes are *not* unencrypted // Check that bytes are *not* unencrypted
char c2; char c2;
EXPECT_EQ(1, recv(fds[1], &c2, 1, MSG_PEEK)); EXPECT_EQ(1, netops::recv(fds[1], &c2, 1, MSG_PEEK));
EXPECT_NE('a', c2); EXPECT_NE('a', c2);
base.loop(); base.loop();
...@@ -1968,7 +1964,7 @@ TEST(AsyncSSLSocketTest, SSLAcceptRunnerBasic) { ...@@ -1968,7 +1964,7 @@ TEST(AsyncSSLSocketTest, SSLAcceptRunnerBasic) {
clientCtx->ciphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"); clientCtx->ciphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
clientCtx->loadTrustedCertificates(kTestCA); clientCtx->loadTrustedCertificates(kTestCA);
int fds[2]; NetworkSocket fds[2];
getfds(fds); getfds(fds);
AsyncSSLSocket::UniquePtr clientSock( AsyncSSLSocket::UniquePtr clientSock(
...@@ -2003,7 +1999,7 @@ TEST(AsyncSSLSocketTest, SSLAcceptRunnerAcceptError) { ...@@ -2003,7 +1999,7 @@ TEST(AsyncSSLSocketTest, SSLAcceptRunnerAcceptError) {
clientCtx->ciphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"); clientCtx->ciphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
clientCtx->loadTrustedCertificates(kTestCA); clientCtx->loadTrustedCertificates(kTestCA);
int fds[2]; NetworkSocket fds[2];
getfds(fds); getfds(fds);
AsyncSSLSocket::UniquePtr clientSock( AsyncSSLSocket::UniquePtr clientSock(
...@@ -2037,7 +2033,7 @@ TEST(AsyncSSLSocketTest, SSLAcceptRunnerAcceptClose) { ...@@ -2037,7 +2033,7 @@ TEST(AsyncSSLSocketTest, SSLAcceptRunnerAcceptClose) {
clientCtx->ciphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"); clientCtx->ciphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
clientCtx->loadTrustedCertificates(kTestCA); clientCtx->loadTrustedCertificates(kTestCA);
int fds[2]; NetworkSocket fds[2];
getfds(fds); getfds(fds);
AsyncSSLSocket::UniquePtr clientSock( AsyncSSLSocket::UniquePtr clientSock(
...@@ -2071,7 +2067,7 @@ TEST(AsyncSSLSocketTest, SSLAcceptRunnerAcceptDestroy) { ...@@ -2071,7 +2067,7 @@ TEST(AsyncSSLSocketTest, SSLAcceptRunnerAcceptDestroy) {
clientCtx->ciphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"); clientCtx->ciphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
clientCtx->loadTrustedCertificates(kTestCA); clientCtx->loadTrustedCertificates(kTestCA);
int fds[2]; NetworkSocket fds[2];
getfds(fds); getfds(fds);
AsyncSSLSocket::UniquePtr clientSock( AsyncSSLSocket::UniquePtr clientSock(
...@@ -2492,7 +2488,7 @@ TEST(AsyncSSLSocketTest, TestPreReceivedData) { ...@@ -2492,7 +2488,7 @@ TEST(AsyncSSLSocketTest, TestPreReceivedData) {
EventBase eventBase; EventBase eventBase;
auto clientCtx = std::make_shared<SSLContext>(); auto clientCtx = std::make_shared<SSLContext>();
auto dfServerCtx = std::make_shared<SSLContext>(); auto dfServerCtx = std::make_shared<SSLContext>();
std::array<int, 2> fds; std::array<NetworkSocket, 2> fds;
getfds(fds.data()); getfds(fds.data());
getctx(clientCtx, dfServerCtx); getctx(clientCtx, dfServerCtx);
...@@ -2506,7 +2502,7 @@ TEST(AsyncSSLSocketTest, TestPreReceivedData) { ...@@ -2506,7 +2502,7 @@ TEST(AsyncSSLSocketTest, TestPreReceivedData) {
// Steal some data from the server. // Steal some data from the server.
std::array<uint8_t, 10> buf; std::array<uint8_t, 10> buf;
auto bytesReceived = recv(fds[1], buf.data(), buf.size(), 0); auto bytesReceived = netops::recv(fds[1], buf.data(), buf.size(), 0);
checkUnixError(bytesReceived, "recv failed"); checkUnixError(bytesReceived, "recv failed");
serverSock->setPreReceivedData( serverSock->setPreReceivedData(
...@@ -2526,7 +2522,7 @@ TEST(AsyncSSLSocketTest, TestMoveFromAsyncSocket) { ...@@ -2526,7 +2522,7 @@ TEST(AsyncSSLSocketTest, TestMoveFromAsyncSocket) {
EventBase eventBase; EventBase eventBase;
auto clientCtx = std::make_shared<SSLContext>(); auto clientCtx = std::make_shared<SSLContext>();
auto dfServerCtx = std::make_shared<SSLContext>(); auto dfServerCtx = std::make_shared<SSLContext>();
std::array<int, 2> fds; std::array<NetworkSocket, 2> fds;
getfds(fds.data()); getfds(fds.data());
getctx(clientCtx, dfServerCtx); getctx(clientCtx, dfServerCtx);
...@@ -2539,7 +2535,7 @@ TEST(AsyncSSLSocketTest, TestMoveFromAsyncSocket) { ...@@ -2539,7 +2535,7 @@ TEST(AsyncSSLSocketTest, TestMoveFromAsyncSocket) {
// Steal some data from the server. // Steal some data from the server.
std::array<uint8_t, 10> buf; std::array<uint8_t, 10> buf;
auto bytesReceived = recv(fds[1], buf.data(), buf.size(), 0); auto bytesReceived = netops::recv(fds[1], buf.data(), buf.size(), 0);
checkUnixError(bytesReceived, "recv failed"); checkUnixError(bytesReceived, "recv failed");
serverSock->setPreReceivedData( serverSock->setPreReceivedData(
......
...@@ -776,7 +776,7 @@ class TestSSLAsyncCacheServer : public TestSSLServer { ...@@ -776,7 +776,7 @@ class TestSSLAsyncCacheServer : public TestSSLServer {
} }
}; };
void getfds(int fds[2]); void getfds(NetworkSocket fds[2]);
void getctx( void getctx(
std::shared_ptr<folly::SSLContext> clientCtx, std::shared_ptr<folly::SSLContext> clientCtx,
......
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