#pragma once
-#include <folly/io/IOBufQueue.h>
#include <folly/Memory.h>
+#include <folly/io/IOBufQueue.h>
#include <folly/io/async/AsyncUDPSocket.h>
#include <folly/io/async/EventBase.h>
nextListener_(0) {
}
- ~AsyncUDPServerSocket() {
+ ~AsyncUDPServerSocket() override {
if (socket_) {
close();
}
return socket_->address();
}
- void getAddress(SocketAddress* a) const {
+ void getAddress(SocketAddress* a) const override {
*a = address();
}
socket_.reset();
}
- EventBase* getEventBase() const {
+ EventBase* getEventBase() const override {
return evb_;
}
private:
// AsyncUDPSocket::ReadCallback
- void getReadBuffer(void** buf, size_t* len) noexcept {
+ void getReadBuffer(void** buf, size_t* len) noexcept override {
std::tie(*buf, *len) = buf_.preallocate(packetSize_, packetSize_);
}
- void onDataAvailable(const folly::SocketAddress& clientAddress,
- size_t len,
- bool truncated) noexcept {
+ void onDataAvailable(
+ const folly::SocketAddress& clientAddress,
+ size_t len,
+ bool truncated) noexcept override {
buf_.postallocate(len);
auto data = buf_.split(len);
++nextListener_;
}
- void onReadError(const AsyncSocketException& ex) noexcept {
+ void onReadError(const AsyncSocketException& ex) noexcept override {
LOG(ERROR) << ex.what();
// Lets register to continue listening for packets
socket_->resumeRead(this);
}
- void onReadClosed() noexcept {
+ void onReadClosed() noexcept override {
for (auto& listener: listeners_) {
auto callback = listener.second;
bool reusePort_{false};
};
-} // Namespace
+} // namespace folly