Fix copyright lines
[folly.git] / folly / io / async / test / AsyncSocketTest.h
index 95f302e47deb57f46835ee3c5d346195d0190e2f..fe69a4e4b3a35c57c9ab6a5f0303d39a32d55e59 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 Facebook, Inc.
+ * Copyright 2015-present Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
 #include <folly/portability/Sockets.h>
 
 #include <boost/scoped_array.hpp>
+#include <memory>
 
 enum StateEnum {
   STATE_WAITING,
@@ -82,7 +83,7 @@ class WriteCallback : public folly::AsyncTransportWrapper::WriteCallback {
   }
 
   StateEnum state;
-  size_t bytesWritten;
+  std::atomic<size_t> bytesWritten;
   folly::AsyncSocketException exception;
   VoidCallback successCallback;
   VoidCallback errorCallback;
@@ -370,7 +371,7 @@ class TestServer {
 
   std::shared_ptr<BlockingSocket> accept(int timeout=50) {
     int fd = acceptFD(timeout);
-    return std::shared_ptr<BlockingSocket>(new BlockingSocket(fd));
+    return std::make_shared<BlockingSocket>(fd);
   }
 
   std::shared_ptr<folly::AsyncSocket> acceptAsync(folly::EventBase* evb,