Fix RequestContext held too long issue in EventBase
[folly.git] / folly / io / async / AsyncUDPServerSocket.h
index 651eb1cacd446fe6ded1e93c41d47cac839760c5..d371fd4d98f3d4c049e6c399541ae99bf4ab8d7a 100644 (file)
@@ -16,8 +16,8 @@
 
 #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>
 
@@ -77,7 +77,7 @@ class AsyncUDPServerSocket : private AsyncUDPSocket::ReadCallback
         nextListener_(0) {
   }
 
-  ~AsyncUDPServerSocket() {
+  ~AsyncUDPServerSocket() override {
     if (socket_) {
       close();
     }
@@ -100,7 +100,7 @@ class AsyncUDPServerSocket : private AsyncUDPSocket::ReadCallback
     return socket_->address();
   }
 
-  void getAddress(SocketAddress* a) const {
+  void getAddress(SocketAddress* a) const override {
     *a = address();
   }
 
@@ -136,19 +136,20 @@ class AsyncUDPServerSocket : private AsyncUDPSocket::ReadCallback
     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);
 
@@ -182,14 +183,14 @@ class AsyncUDPServerSocket : private AsyncUDPSocket::ReadCallback
     ++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;
 
@@ -217,4 +218,4 @@ class AsyncUDPServerSocket : private AsyncUDPSocket::ReadCallback
   bool reusePort_{false};
 };
 
-} // Namespace
+} // namespace folly