Commit 348bc38c authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Cut unused AsyncSocket::isBufferMovable_

Summary: [Folly] Cut unused `AsyncSocket::isBufferMutovable_` and constants `SSL_MODE_MOVE_BUFFER_OWNERSHIP` and `kOpenSslModeMoveBufferOwnership`.

Reviewed By: w-o-o

Differential Revision: D19286264

fbshipit-source-id: 57e28e65cf86fd550fa8fe81e1657a2e9409e459
parent 9f739b38
...@@ -2019,7 +2019,7 @@ void AsyncSocket::handleRead() noexcept { ...@@ -2019,7 +2019,7 @@ void AsyncSocket::handleRead() noexcept {
"non-exception type"); "non-exception type");
return failRead(__func__, ex); return failRead(__func__, ex);
} }
if (!isBufferMovable_ && (buf == nullptr || buflen == 0)) { if (buf == nullptr || buflen == 0) {
AsyncSocketException ex( AsyncSocketException ex(
AsyncSocketException::BAD_ARGS, AsyncSocketException::BAD_ARGS,
"ReadCallback::getReadBuffer() returned " "ReadCallback::getReadBuffer() returned "
...@@ -2033,18 +2033,7 @@ void AsyncSocket::handleRead() noexcept { ...@@ -2033,18 +2033,7 @@ void AsyncSocket::handleRead() noexcept {
VLOG(4) << "this=" << this << ", AsyncSocket::handleRead() got " VLOG(4) << "this=" << this << ", AsyncSocket::handleRead() got "
<< bytesRead << " bytes"; << bytesRead << " bytes";
if (bytesRead > 0) { if (bytesRead > 0) {
if (!isBufferMovable_) { readCallback_->readDataAvailable(size_t(bytesRead));
readCallback_->readDataAvailable(size_t(bytesRead));
} else {
CHECK(kOpenSslModeMoveBufferOwnership);
VLOG(5) << "this=" << this << ", AsyncSocket::handleRead() got "
<< "buf=" << buf << ", " << bytesRead << "/" << buflen
<< ", offset=" << offset;
auto readBuf = folly::IOBuf::takeOwnership(buf, buflen);
readBuf->trimStart(offset);
readBuf->trimEnd(buflen - offset - bytesRead);
readCallback_->readBufferAvailable(std::move(readBuf));
}
// Fall through and continue around the loop if the read // Fall through and continue around the loop if the read
// completely filled the available buffer. // completely filled the available buffer.
......
...@@ -1294,8 +1294,6 @@ class AsyncSocket : virtual public AsyncTransportWrapper { ...@@ -1294,8 +1294,6 @@ class AsyncSocket : virtual public AsyncTransportWrapper {
uint32_t sendTimeout_; ///< The send timeout, in milliseconds uint32_t sendTimeout_; ///< The send timeout, in milliseconds
uint16_t maxReadsPerEvent_; ///< Max reads per event loop iteration uint16_t maxReadsPerEvent_; ///< Max reads per event loop iteration
bool isBufferMovable_{false};
int8_t readErr_{READ_NO_ERROR}; ///< The read error encountered, if any int8_t readErr_{READ_NO_ERROR}; ///< The read error encountered, if any
EventBase* eventBase_; ///< The EventBase EventBase* eventBase_; ///< The EventBase
......
...@@ -27,14 +27,6 @@ ...@@ -27,14 +27,6 @@
#include <folly/portability/SysUio.h> #include <folly/portability/SysUio.h>
#include <folly/ssl/OpenSSLPtrTypes.h> #include <folly/ssl/OpenSSLPtrTypes.h>
constexpr bool kOpenSslModeMoveBufferOwnership =
#ifdef SSL_MODE_MOVE_BUFFER_OWNERSHIP
true
#else
false
#endif
;
namespace folly { namespace folly {
class AsyncSocketException; class AsyncSocketException;
......
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