Commit 7f22ad99 authored by Igor Sugak's avatar Igor Sugak Committed by Sara Golemon

Add missing override and remove redundant virtual in folly

Summary: Running clang-tidy to fix this problem, using script D2171334.

I noticed that even without this change clang dev build succeeds for folly and opened a separate task to investigate why.

Reviewed By: @markisaa

Differential Revision: D2179299
parent 61a1244e
......@@ -32,8 +32,7 @@ class ElfTest : public ::testing::Test {
ElfTest() : elfFile_(binaryPath.c_str()) {
}
virtual ~ElfTest() {
}
~ElfTest() override {}
protected:
ElfFile elfFile_;
......
......@@ -64,7 +64,7 @@ void bar() {
class ElfCacheTest : public testing::Test {
protected:
void SetUp();
void SetUp() override;
};
// Capture "golden" stack trace with default-configured Symbolizer
......
......@@ -31,7 +31,7 @@ class ThreadWheelTimekeeper : public Timekeeper {
public:
/// But it doesn't *have* to be a singleton.
ThreadWheelTimekeeper();
~ThreadWheelTimekeeper();
~ThreadWheelTimekeeper() override;
/// Implement the Timekeeper interface
/// This future *does* complete on the timer thread. You should almost
......
......@@ -23,7 +23,7 @@ using namespace folly;
class TestData : public RequestData {
public:
explicit TestData(int data) : data_(data) {}
virtual ~TestData() {}
~TestData() override {}
int data_;
};
......
......@@ -56,7 +56,7 @@ struct ViaFixture : public testing::Test {
});
}
~ViaFixture() {
~ViaFixture() override {
done = true;
eastExecutor->add([=]() { });
t.join();
......@@ -316,7 +316,7 @@ class ThreadExecutor : public Executor {
worker = std::thread(std::bind(&ThreadExecutor::work, this));
}
~ThreadExecutor() {
~ThreadExecutor() override {
done = true;
funcs.write([]{});
worker.join();
......
......@@ -84,8 +84,7 @@ class AsyncSSLSocketConnector: public AsyncSocket::ConnectCallback,
int64_t startTime_;
protected:
virtual ~AsyncSSLSocketConnector() {
}
~AsyncSSLSocketConnector() override {}
public:
AsyncSSLSocketConnector(AsyncSSLSocket *sslSocket,
......@@ -98,7 +97,7 @@ class AsyncSSLSocketConnector: public AsyncSocket::ConnectCallback,
std::chrono::steady_clock::now().time_since_epoch()).count()) {
}
virtual void connectSuccess() noexcept {
void connectSuccess() noexcept override {
VLOG(7) << "client socket connected";
int64_t timeoutLeft = 0;
......@@ -118,13 +117,13 @@ class AsyncSSLSocketConnector: public AsyncSocket::ConnectCallback,
sslSocket_->sslConn(this, timeoutLeft);
}
virtual void connectErr(const AsyncSocketException& ex) noexcept {
void connectErr(const AsyncSocketException& ex) noexcept override {
LOG(ERROR) << "TCP connect failed: " << ex.what();
fail(ex);
delete this;
}
virtual void handshakeSuc(AsyncSSLSocket *sock) noexcept {
void handshakeSuc(AsyncSSLSocket* sock) noexcept override {
VLOG(7) << "client handshake success";
if (callback_) {
callback_->connectSuccess();
......@@ -132,8 +131,8 @@ class AsyncSSLSocketConnector: public AsyncSocket::ConnectCallback,
delete this;
}
virtual void handshakeErr(AsyncSSLSocket *socket,
const AsyncSocketException& ex) noexcept {
void handshakeErr(AsyncSSLSocket* socket,
const AsyncSocketException& ex) noexcept override {
LOG(ERROR) << "client handshakeErr: " << ex.what();
fail(ex);
delete this;
......
......@@ -121,9 +121,7 @@ class AsyncServerSocket::BackoffTimeout : public AsyncTimeout {
BackoffTimeout(AsyncServerSocket* socket)
: AsyncTimeout(socket->getEventBase()), socket_(socket) {}
virtual void timeoutExpired() noexcept {
socket_->backoffTimeoutExpired();
}
void timeoutExpired() noexcept override { socket_->backoffTimeoutExpired(); }
private:
AsyncServerSocket* socket_;
......
......@@ -148,7 +148,7 @@ class AsyncSocket::BytesWriteRequest : public AsyncSocket::WriteRequest {
}
// private destructor, to ensure callers use destroy()
virtual ~BytesWriteRequest() = default;
~BytesWriteRequest() override = default;
const struct iovec* getOps() const {
assert(opCount_ > opIndex_);
......
......@@ -44,7 +44,7 @@ class FunctionLoopCallback : public EventBase::LoopCallback {
explicit FunctionLoopCallback(const Cob& function)
: function_(function) {}
virtual void runLoopCallback() noexcept {
void runLoopCallback() noexcept override {
function_();
delete this;
}
......@@ -66,7 +66,7 @@ const int kNoFD = -1;
class EventBase::FunctionRunner
: public NotificationQueue<std::pair<void (*)(void*), void*>>::Consumer {
public:
void messageAvailable(std::pair<void (*)(void*), void*>&& msg) {
void messageAvailable(std::pair<void (*)(void*), void*>&& msg) override {
// In libevent2, internal events do not break the loop.
// Most users would expect loop(), followed by runInEventBaseThread(),
......
......@@ -1263,7 +1263,7 @@ class AsyncSocketImmediateRead : public folly::AsyncSocket {
bool immediateReadCalled = false;
explicit AsyncSocketImmediateRead(folly::EventBase* evb) : AsyncSocket(evb) {}
protected:
virtual void checkForImmediateRead() noexcept override {
void checkForImmediateRead() noexcept override {
immediateReadCalled = true;
AsyncSocket::handleRead();
}
......@@ -1441,29 +1441,29 @@ class TestAcceptCallback : public AsyncServerSocket::AcceptCallback {
acceptStoppedFn_ = fn;
}
void connectionAccepted(int fd, const folly::SocketAddress& clientAddr)
noexcept {
void connectionAccepted(
int fd, const folly::SocketAddress& clientAddr) noexcept override {
events_.emplace_back(fd, clientAddr);
if (connectionAcceptedFn_) {
connectionAcceptedFn_(fd, clientAddr);
}
}
void acceptError(const std::exception& ex) noexcept {
void acceptError(const std::exception& ex) noexcept override {
events_.emplace_back(ex.what());
if (acceptErrorFn_) {
acceptErrorFn_(ex);
}
}
void acceptStarted() noexcept {
void acceptStarted() noexcept override {
events_.emplace_back(TYPE_START);
if (acceptStartedFn_) {
acceptStartedFn_();
}
}
void acceptStopped() noexcept {
void acceptStopped() noexcept override {
events_.emplace_back(TYPE_STOP);
if (acceptStoppedFn_) {
......
......@@ -41,16 +41,14 @@ class UDPAcceptor
UDPAcceptor(EventBase* evb, int n): evb_(evb), n_(n) {
}
void onListenStarted() noexcept {
}
void onListenStarted() noexcept override {}
void onListenStopped() noexcept {
}
void onListenStopped() noexcept override {}
void onDataAvailable(std::shared_ptr<folly::AsyncUDPSocket> socket,
const folly::SocketAddress& client,
std::unique_ptr<folly::IOBuf> data,
bool truncated) noexcept {
bool truncated) noexcept override {
lastClient_ = client;
lastMsg_ = data->moveToFbString().toStdString();
......@@ -206,14 +204,14 @@ class UDPClient
folly::IOBuf::copyBuffer(folly::to<std::string>("PING ", n_)));
}
void getReadBuffer(void** buf, size_t* len) noexcept {
void getReadBuffer(void** buf, size_t* len) noexcept override {
*buf = buf_;
*len = 1024;
}
void onDataAvailable(const folly::SocketAddress& client,
size_t len,
bool truncated) noexcept {
bool truncated) noexcept override {
VLOG(4) << "Read " << len << " bytes (trun:" << truncated << ") from "
<< client.describe() << " - " << std::string(buf_, len);
VLOG(4) << n_ << " left";
......@@ -223,18 +221,18 @@ class UDPClient
sendPing();
}
void onReadError(const folly::AsyncSocketException& ex) noexcept {
void onReadError(const folly::AsyncSocketException& ex) noexcept override {
VLOG(4) << ex.what();
// Start listening for next PONG
socket_->resumeRead(this);
}
void onReadClosed() noexcept {
void onReadClosed() noexcept override {
CHECK(false) << "We unregister reads before closing";
}
void timeoutExpired() noexcept {
void timeoutExpired() noexcept override {
VLOG(4) << "Timeout expired";
sendPing();
}
......
......@@ -27,7 +27,7 @@ class CountedLoopCallback : public EventBase::LoopCallback {
: eventBase_(eventBase)
, count_(count) {}
virtual void runLoopCallback() noexcept {
void runLoopCallback() noexcept override {
--count_;
if (count_ > 0) {
eventBase_->runInLoop(this);
......
......@@ -141,7 +141,7 @@ class TestHandler : public EventHandler {
TestHandler(EventBase* eventBase, int fd)
: EventHandler(eventBase, fd), fd_(fd) {}
virtual void handlerReady(uint16_t events) noexcept {
void handlerReady(uint16_t events) noexcept override {
ssize_t bytesRead = 0;
ssize_t bytesWritten = 0;
if (events & READ) {
......@@ -645,7 +645,7 @@ class PartialReadHandler : public TestHandler {
PartialReadHandler(EventBase* eventBase, int fd, size_t readLength)
: TestHandler(eventBase, fd), fd_(fd), readLength_(readLength) {}
virtual void handlerReady(uint16_t events) noexcept {
void handlerReady(uint16_t events) noexcept override {
assert(events == EventHandler::READ);
ssize_t bytesRead = readFromFD(fd_, readLength_);
log.emplace_back(events, bytesRead, 0);
......@@ -710,7 +710,7 @@ class PartialWriteHandler : public TestHandler {
PartialWriteHandler(EventBase* eventBase, int fd, size_t writeLength)
: TestHandler(eventBase, fd), fd_(fd), writeLength_(writeLength) {}
virtual void handlerReady(uint16_t events) noexcept {
void handlerReady(uint16_t events) noexcept override {
assert(events == EventHandler::WRITE);
ssize_t bytesWritten = writeToFD(fd_, writeLength_);
log.emplace_back(events, 0, bytesWritten);
......@@ -780,9 +780,7 @@ TEST(EventBaseTest, DestroyHandler) {
: AsyncTimeout(eb)
, handler_(h) {}
virtual void timeoutExpired() noexcept {
delete handler_;
}
void timeoutExpired() noexcept override { delete handler_; }
private:
EventHandler* handler_;
......@@ -895,9 +893,7 @@ class TestTimeout : public AsyncTimeout {
: AsyncTimeout(eventBase)
, timestamp(false) {}
virtual void timeoutExpired() noexcept {
timestamp.reset();
}
void timeoutExpired() noexcept override { timestamp.reset(); }
TimePoint timestamp;
};
......@@ -933,7 +929,7 @@ class ReschedulingTimeout : public AsyncTimeout {
reschedule();
}
virtual void timeoutExpired() noexcept {
void timeoutExpired() noexcept override {
timestamps.emplace_back();
reschedule();
}
......@@ -1052,9 +1048,7 @@ TEST(EventBaseTest, DestroyTimeout) {
: AsyncTimeout(eb)
, timeout_(t) {}
virtual void timeoutExpired() noexcept {
delete timeout_;
}
void timeoutExpired() noexcept override { delete timeout_; }
private:
AsyncTimeout* timeout_;
......@@ -1269,7 +1263,7 @@ class CountedLoopCallback : public EventBase::LoopCallback {
, count_(count)
, action_(action) {}
virtual void runLoopCallback() noexcept {
void runLoopCallback() noexcept override {
--count_;
if (count_ > 0) {
eventBase_->runInLoop(this);
......@@ -1437,7 +1431,7 @@ class TerminateTestCallback : public EventBase::LoopCallback,
unregisterHandler();
}
virtual void handlerReady(uint16_t events) noexcept {
void handlerReady(uint16_t events) noexcept override {
// We didn't register with PERSIST, so we will have been automatically
// unregistered already.
ASSERT_FALSE(isHandlerRegistered());
......@@ -1449,7 +1443,7 @@ class TerminateTestCallback : public EventBase::LoopCallback,
eventBase_->runInLoop(this);
}
virtual void runLoopCallback() noexcept {
void runLoopCallback() noexcept override {
++loopInvocations_;
if (loopInvocations_ >= maxLoopInvocations_) {
return;
......@@ -1526,9 +1520,9 @@ class IdleTimeTimeoutSeries : public AsyncTimeout {
scheduleTimeout(1);
}
virtual ~IdleTimeTimeoutSeries() {}
~IdleTimeTimeoutSeries() override {}
void timeoutExpired() noexcept {
void timeoutExpired() noexcept override {
++timeouts_;
if(timeout_.empty()){
......@@ -1696,9 +1690,7 @@ public:
PipeHandler(EventBase* eventBase, int fd)
: EventHandler(eventBase, fd) {}
void handlerReady(uint16_t events) noexcept {
abort();
}
void handlerReady(uint16_t events) noexcept override { abort(); }
};
TEST(EventBaseTest, StopBeforeLoop) {
......
......@@ -133,7 +133,7 @@ TEST(CompressionTestNeedsUncompressedLength, Simple) {
class CompressionTest
: public testing::TestWithParam<std::tr1::tuple<int, CodecType>> {
protected:
void SetUp() {
void SetUp() override {
auto tup = GetParam();
uncompressedLength_ = uint64_t(1) << std::tr1::get<0>(tup);
codec_ = getCodec(std::tr1::get<1>(tup));
......@@ -185,7 +185,7 @@ INSTANTIATE_TEST_CASE_P(
class CompressionVarintTest
: public testing::TestWithParam<std::tr1::tuple<int, CodecType>> {
protected:
void SetUp() {
void SetUp() override {
auto tup = GetParam();
uncompressedLength_ = uint64_t(1) << std::tr1::get<0>(tup);
codec_ = getCodec(std::tr1::get<1>(tup));
......@@ -237,9 +237,7 @@ INSTANTIATE_TEST_CASE_P(
class CompressionCorruptionTest : public testing::TestWithParam<CodecType> {
protected:
void SetUp() {
codec_ = getCodec(GetParam());
}
void SetUp() override { codec_ = getCodec(GetParam()); }
void runSimpleTest(const DataHolder& dh);
......
......@@ -832,7 +832,7 @@ enum BufType {
class MoveToFbStringTest
: public ::testing::TestWithParam<std::tr1::tuple<int, int, bool, BufType>> {
protected:
void SetUp() {
void SetUp() override {
elementSize_ = std::tr1::get<0>(GetParam());
elementCount_ = std::tr1::get<1>(GetParam());
shared_ = std::tr1::get<2>(GetParam());
......
......@@ -139,8 +139,8 @@ public:
explicit IntException(int i)
: i_(i) {}
virtual int getInt() const override { return i_; }
virtual const char* what() const noexcept override {
int getInt() const override { return i_; }
const char* what() const noexcept override {
what_ = folly::to<std::string>("int == ", i_);
return what_.c_str();
}
......
......@@ -84,7 +84,7 @@ class IntPaddedTestBase : public ::testing::Test {
class IntPaddedConstTest : public IntPaddedTestBase {
protected:
void SetUp() {
void SetUp() override {
v_.resize(4);
n_ = 0;
for (int i = 0; i < 4; i++) {
......@@ -181,7 +181,7 @@ class StructPaddedTestBase : public ::testing::Test {
class StructPaddedConstTest : public StructPaddedTestBase {
protected:
void SetUp() {
void SetUp() override {
v_.resize(4);
n_ = 0;
for (int i = 0; i < 4; i++) {
......
......@@ -28,7 +28,7 @@ class Base {
class Derived : public Base {
public:
virtual int foo() const FOLLY_FINAL { return 2; }
int foo() const FOLLY_FINAL { return 2; }
};
// A compiler that supports final will likely inline the call to p->foo()
......
......@@ -25,11 +25,9 @@
class Exception : public std::exception {
public:
explicit Exception(const std::string& value) : value_(value) {}
virtual ~Exception(void) noexcept {}
~Exception(void) noexcept override {}
virtual const char *what(void) const noexcept {
return value_.c_str();
}
const char* what(void) const noexcept override { return value_.c_str(); }
private:
std::string value_;
......
......@@ -69,30 +69,27 @@ class AcceptorHandshakeHelper :
socket_->sslAccept(this);
}
virtual void timeoutExpired() noexcept override {
void timeoutExpired() noexcept override {
VLOG(4) << "SSL handshake timeout expired";
sslError_ = SSLErrorEnum::TIMEOUT;
dropConnection();
}
virtual void describe(std::ostream& os) const override {
void describe(std::ostream& os) const override {
os << "pending handshake on " << clientAddr_;
}
virtual bool isBusy() const override {
return true;
}
virtual void notifyPendingShutdown() override {}
virtual void closeWhenIdle() override {}
bool isBusy() const override { return true; }
void notifyPendingShutdown() override {}
void closeWhenIdle() override {}
virtual void dropConnection() override {
void dropConnection() override {
VLOG(10) << "Dropping in progress handshake for " << clientAddr_;
socket_->closeNow();
}
virtual void dumpConnectionState(uint8_t loglevel) override {
}
void dumpConnectionState(uint8_t loglevel) override {}
private:
// AsyncSSLSocket::HandshakeCallback API
virtual void handshakeSuc(AsyncSSLSocket* sock) noexcept override {
void handshakeSuc(AsyncSSLSocket* sock) noexcept override {
const unsigned char* nextProto = nullptr;
unsigned nextProtoLength = 0;
......@@ -146,8 +143,8 @@ class AcceptorHandshakeHelper :
delete this;
}
virtual void handshakeErr(AsyncSSLSocket* sock,
const AsyncSocketException& ex) noexcept override {
void handshakeErr(AsyncSSLSocket* sock,
const AsyncSocketException& ex) noexcept override {
auto elapsedTime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - acceptTime_);
VLOG(3) << "SSL handshake error after " << elapsedTime.count() <<
" ms; " << sock->getRawBytesReceived() << " bytes received & " <<
......
......@@ -33,7 +33,7 @@ typedef ClientBootstrap<BytesPipeline> TestClient;
class TestClientPipelineFactory : public PipelineFactory<BytesPipeline> {
public:
std::unique_ptr<BytesPipeline, folly::DelayedDestruction::Destructor>
newPipeline(std::shared_ptr<AsyncSocket> sock) {
newPipeline(std::shared_ptr<AsyncSocket> sock) override {
// We probably aren't connected immedately, check after a small delay
EventBaseManager::get()->getEventBase()->tryRunAfterDelay([sock](){
CHECK(sock->good());
......@@ -45,8 +45,8 @@ class TestClientPipelineFactory : public PipelineFactory<BytesPipeline> {
class TestPipelineFactory : public PipelineFactory<BytesPipeline> {
public:
std::unique_ptr<BytesPipeline, folly::DelayedDestruction::Destructor> newPipeline(
std::shared_ptr<AsyncSocket> sock) {
std::unique_ptr<BytesPipeline, folly::DelayedDestruction::Destructor>
newPipeline(std::shared_ptr<AsyncSocket> sock) override {
pipelines++;
return std::unique_ptr<BytesPipeline, folly::DelayedDestruction::Destructor>(
......@@ -61,17 +61,15 @@ EventBase base_;
TestAcceptor() : Acceptor(ServerSocketConfig()) {
Acceptor::init(nullptr, &base_);
}
void onNewConnection(
AsyncSocket::UniquePtr sock,
const folly::SocketAddress* address,
const std::string& nextProtocolName,
const TransportInfo& tinfo) {
}
void onNewConnection(AsyncSocket::UniquePtr sock,
const folly::SocketAddress* address,
const std::string& nextProtocolName,
const TransportInfo& tinfo) override {}
};
class TestAcceptorFactory : public AcceptorFactory {
public:
std::shared_ptr<Acceptor> newAcceptor(EventBase* base) {
std::shared_ptr<Acceptor> newAcceptor(EventBase* base) override {
return std::make_shared<TestAcceptor>();
}
};
......@@ -272,7 +270,7 @@ std::atomic<int> connections{0};
class TestHandlerPipeline : public InboundHandler<void*> {
public:
void read(Context* ctx, void* conn) {
void read(Context* ctx, void* conn) override {
connections++;
return ctx->fireRead(conn);
}
......@@ -284,7 +282,7 @@ class TestHandlerPipelineFactory
public:
std::unique_ptr<ServerBootstrap<BytesPipeline>::AcceptPipeline,
folly::DelayedDestruction::Destructor>
newPipeline(std::shared_ptr<AsyncSocket>) {
newPipeline(std::shared_ptr<AsyncSocket>) override {
std::unique_ptr<ServerBootstrap<BytesPipeline>::AcceptPipeline,
folly::DelayedDestruction::Destructor> pipeline(
......@@ -320,9 +318,7 @@ TEST(Bootstrap, LoadBalanceHandler) {
class TestUDPPipeline : public InboundHandler<void*> {
public:
void read(Context* ctx, void* conn) {
connections++;
}
void read(Context* ctx, void* conn) override { connections++; }
};
TEST(Bootstrap, UDP) {
......
......@@ -38,7 +38,7 @@ struct FileRegionTest : public Test {
EXPECT_EQ(0, unlink(path));
}
~FileRegionTest() {
~FileRegionTest() override {
// Close up shop
close(fd);
acceptedSocket->close();
......
......@@ -265,8 +265,8 @@ template <class Rin, class Rout = Rin, class Win = Rout, class Wout = Rin>
class ConcreteHandler : public Handler<Rin, Rout, Win, Wout> {
typedef typename Handler<Rin, Rout, Win, Wout>::Context Context;
public:
void read(Context* ctx, Rin msg) {}
Future<void> write(Context* ctx, Win msg) { return makeFuture(); }
void read(Context* ctx, Rin msg) override {}
Future<void> write(Context* ctx, Win msg) override { return makeFuture(); }
};
typedef HandlerAdapter<std::string, std::string> StringHandler;
......
......@@ -30,11 +30,11 @@ class FrameTester
explicit FrameTester(std::function<void(std::unique_ptr<IOBuf>)> test)
: test_(test) {}
void read(Context* ctx, std::unique_ptr<IOBuf> buf) {
void read(Context* ctx, std::unique_ptr<IOBuf> buf) override {
test_(std::move(buf));
}
void readException(Context* ctx, exception_wrapper w) {
void readException(Context* ctx, exception_wrapper w) override {
test_(nullptr);
}
private:
......@@ -44,8 +44,7 @@ class FrameTester
class BytesReflector
: public BytesToBytesHandler {
public:
Future<void> write(Context* ctx, std::unique_ptr<IOBuf> buf) {
Future<void> write(Context* ctx, std::unique_ptr<IOBuf> buf) override {
IOBufQueue q_(IOBufQueue::cacheChainLength());
q_.append(std::move(buf));
ctx->fireRead(q_);
......
......@@ -33,11 +33,9 @@ class MemoryIdlerTimeout
public:
explicit MemoryIdlerTimeout(EventBase* b) : AsyncTimeout(b), base_(b) {}
virtual void timeoutExpired() noexcept {
idled = true;
}
void timeoutExpired() noexcept override { idled = true; }
virtual void runLoopCallback() noexcept {
void runLoopCallback() noexcept override {
if (idled) {
MemoryIdler::flushLocalMallocCaches();
MemoryIdler::unmapUnusedStack(MemoryIdler::kDefaultStackToRetain);
......
......@@ -322,16 +322,12 @@ TEST(ThreadPoolExecutorTest, PriorityPreemptionTest) {
class TestObserver : public ThreadPoolExecutor::Observer {
public:
void threadStarted(ThreadPoolExecutor::ThreadHandle*) {
void threadStarted(ThreadPoolExecutor::ThreadHandle*) override { threads_++; }
void threadStopped(ThreadPoolExecutor::ThreadHandle*) override { threads_--; }
void threadPreviouslyStarted(ThreadPoolExecutor::ThreadHandle*) override {
threads_++;
}
void threadStopped(ThreadPoolExecutor::ThreadHandle*) {
threads_--;
}
void threadPreviouslyStarted(ThreadPoolExecutor::ThreadHandle*) {
threads_++;
}
void threadNotYetStopped(ThreadPoolExecutor::ThreadHandle*) {
void threadNotYetStopped(ThreadPoolExecutor::ThreadHandle*) override {
threads_--;
}
void checkCalls() {
......
......@@ -29,22 +29,21 @@ typedef Pipeline<IOBufQueue&, std::string> ServicePipeline;
class SimpleDecode : public ByteToMessageCodec {
public:
virtual std::unique_ptr<IOBuf> decode(
Context* ctx, IOBufQueue& buf, size_t&) {
std::unique_ptr<IOBuf> decode(Context* ctx,
IOBufQueue& buf,
size_t&) override {
return buf.move();
}
};
class EchoService : public Service<std::string, std::string> {
public:
virtual Future<std::string> operator()(std::string req) override {
return req;
}
Future<std::string> operator()(std::string req) override { return req; }
};
class EchoIntService : public Service<std::string, int> {
public:
virtual Future<int> operator()(std::string req) override {
Future<int> operator()(std::string req) override {
return folly::to<int>(req);
}
};
......@@ -143,7 +142,7 @@ class AppendFilter : public ServiceFilter<std::string, std::string> {
std::shared_ptr<Service<std::string, std::string>> service) :
ServiceFilter<std::string, std::string>(service) {}
virtual Future<std::string> operator()(std::string req) {
Future<std::string> operator()(std::string req) override {
return (*service_)(req + "\n");
}
};
......@@ -155,7 +154,7 @@ class IntToStringFilter
std::shared_ptr<Service<std::string, std::string>> service) :
ServiceFilter<int, int, std::string, std::string>(service) {}
virtual Future<int> operator()(int req) {
Future<int> operator()(int req) override {
return (*service_)(folly::to<std::string>(req)).then([](std::string resp) {
return folly::to<int>(resp);
});
......@@ -183,7 +182,7 @@ class ChangeTypeFilter
std::shared_ptr<Service<std::string, int>> service) :
ServiceFilter<int, std::string, std::string, int>(service) {}
virtual Future<std::string> operator()(int req) {
Future<std::string> operator()(int req) override {
return (*service_)(folly::to<std::string>(req)).then([](int resp) {
return folly::to<std::string>(resp);
});
......@@ -204,8 +203,8 @@ class ConnectionCountFilter : public ServiceFactoryFilter<Pipeline, Req, Resp> {
std::shared_ptr<ServiceFactory<Pipeline, Req, Resp>> factory)
: ServiceFactoryFilter<Pipeline, Req, Resp>(factory) {}
virtual Future<std::shared_ptr<Service<Req, Resp>>> operator()(
std::shared_ptr<ClientBootstrap<Pipeline>> client) {
Future<std::shared_ptr<Service<Req, Resp>>> operator()(
std::shared_ptr<ClientBootstrap<Pipeline>> client) override {
connectionCount++;
return (*this->serviceFactory_)(client);
}
......
......@@ -60,7 +60,7 @@ private:
public:
SSLCacheClient(EventBase* eventBase, SSL_SESSION **pSess, ClientRunner* cr);
~SSLCacheClient() {
~SSLCacheClient() override {
if (session_ && !FLAGS_global)
SSL_SESSION_free(session_);
if (socket_ != nullptr) {
......@@ -75,17 +75,14 @@ public:
void start();
virtual void connectSuccess() noexcept;
void connectSuccess() noexcept override;
virtual void connectErr(const AsyncSocketException& ex)
noexcept ;
void connectErr(const AsyncSocketException& ex) noexcept override;
virtual void handshakeSuc(AsyncSSLSocket* sock) noexcept;
virtual void handshakeErr(
AsyncSSLSocket* sock,
const AsyncSocketException& ex) noexcept;
void handshakeSuc(AsyncSSLSocket* sock) noexcept override;
void handshakeErr(AsyncSSLSocket* sock,
const AsyncSocketException& ex) noexcept override;
};
int
......
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