Return if we handle any error messages to avoid unnecessarily calling recv/send
[folly.git] / folly / io / async / AsyncPipe.h
index 6f9f344b7355c2dad57c5c4ebfd05ed3d6712a82..08db3a3e03ae9f31bdd0efd93e98b47bb2211577 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2015 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#pragma once
 
-#include <folly/io/async/AsyncTransport.h>
-#include <folly/io/async/EventHandler.h>
-#include <folly/io/async/DelayedDestruction.h>
-#include <folly/io/IOBufQueue.h>
+#pragma once
 
 #include <list>
 #include <system_error>
 
+#include <folly/io/IOBufQueue.h>
+#include <folly/io/async/AsyncTransport.h>
+#include <folly/io/async/DelayedDestruction.h>
+#include <folly/io/async/EventHandler.h>
+
 namespace folly {
 
 class AsyncSocketException;
@@ -77,7 +78,7 @@ class AsyncPipeReader : public EventHandler,
   }
 
  private:
-  ~AsyncPipeReader();
+  ~AsyncPipeReader() override;
 
   void handlerReady(uint16_t events) noexcept override;
   void failRead(const AsyncSocketException& ex);
@@ -173,9 +174,9 @@ class AsyncPipeWriter : public EventHandler,
   bool closeOnEmpty_{false};
   std::function<void(int)> closeCb_;
 
-  ~AsyncPipeWriter() {
+  ~AsyncPipeWriter() override {
     closeNow();
   }
 };
 
-} // folly
+} // namespace folly