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

Convert OpenSSLUtils::getBioFd to NetworkSocket

Summary: Also nuke the second argument, as it's always nullptr.

Reviewed By: yfeldblum

Differential Revision: D13104960

fbshipit-source-id: 34d6cfd227d1b4ce2d73de1cc5ec211ec28c869b
parent d0d36d4b
......@@ -1737,8 +1737,8 @@ int AsyncSSLSocket::bioWrite(BIO* b, const char* in, int inl) {
tsslSock->getSendMsgParamsCB()->getAncillaryData(flags, msg.msg_control);
}
auto result = tsslSock->sendSocketMessage(
OpenSSLUtils::getBioFd(b, nullptr), &msg, msg_flags);
auto result =
tsslSock->sendSocketMessage(OpenSSLUtils::getBioFd(b), &msg, msg_flags);
BIO_clear_retry_flags(b);
if (!result.exception && result.writeReturn <= 0) {
if (OpenSSLUtils::getBioShouldRetryWrite(int(result.writeReturn))) {
......@@ -1771,7 +1771,7 @@ int AsyncSSLSocket::bioRead(BIO* b, char* out, int outl) {
sslSock->preReceivedData_ = queue.move();
return static_cast<int>(len);
} else {
auto result = int(recv(OpenSSLUtils::getBioFd(b, nullptr), out, outl, 0));
auto result = int(netops::recv(OpenSSLUtils::getBioFd(b), out, outl, 0));
if (result <= 0 && OpenSSLUtils::getBioShouldRetryWrite(result)) {
BIO_set_retry_read(b);
}
......
......@@ -289,15 +289,12 @@ void* OpenSSLUtils::getBioAppData(BIO* b) {
#endif
}
int OpenSSLUtils::getBioFd(BIO* b, int* fd) {
NetworkSocket OpenSSLUtils::getBioFd(BIO* b) {
auto ret = BIO_get_fd(b, nullptr);
#ifdef _WIN32
int ret = portability::sockets::socket_to_fd((SOCKET)BIO_get_fd(b, fd));
if (fd != nullptr) {
*fd = ret;
}
return ret;
return NetworkSocket((SOCKET)ret);
#else
return BIO_get_fd(b, fd);
return NetworkSocket(ret);
#endif
}
......
......@@ -124,7 +124,7 @@ class OpenSSLUtils {
static int getBioShouldRetryWrite(int ret);
static void setBioAppData(BIO* b, void* ptr);
static void* getBioAppData(BIO* b);
static int getBioFd(BIO* b, int* fd);
static NetworkSocket getBioFd(BIO* b);
static void setBioFd(BIO* b, NetworkSocket fd, int flags);
static void setBioFd(BIO* b, int fd, int flags) {
setBioFd(b, NetworkSocket::fromFd(fd), flags);
......
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