Make most implicit integer truncations and sign conversions explicit
[folly.git] / folly / detail / SocketFastOpen.h
index d01e89b9ecb9f29a61a144fdae17ae4fd96e1030..732dc4bd9fa28579679c2d2c1076f4154783bbee 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 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.
 #include <folly/portability/Sockets.h>
 #include <sys/types.h>
 
-#if !defined(FOLLY_ALLOW_TFO) && defined(__linux__) && !defined(__ANDROID__)
+#if !defined(FOLLY_ALLOW_TFO)
+#if defined(__linux__) || defined(__APPLE__)
 // only allow for linux right now
 #define FOLLY_ALLOW_TFO 1
 #endif
+#endif
 
 namespace folly {
 namespace detail {
@@ -37,5 +39,10 @@ ssize_t tfo_sendmsg(int sockfd, const struct msghdr* msg, int flags);
  * Enable TFO on a listening socket.
  */
 int tfo_enable(int sockfd, size_t max_queue_size);
+
+/**
+ * Check if TFO succeeded in being used.
+ */
+bool tfo_succeeded(int sockfd);
 }
 }