X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2Fdetail%2FSocketFastOpen.h;h=732dc4bd9fa28579679c2d2c1076f4154783bbee;hb=fa172175980b13569ba42008202a857af6e959dd;hp=1295a1e640967311400d06916b4cbe7a0a3e85b5;hpb=46f3788d8acb3d351698d9ffff551807c807caa7;p=folly.git diff --git a/folly/detail/SocketFastOpen.h b/folly/detail/SocketFastOpen.h index 1295a1e6..732dc4bd 100644 --- a/folly/detail/SocketFastOpen.h +++ b/folly/detail/SocketFastOpen.h @@ -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. @@ -19,31 +19,30 @@ #include #include -#if !defined(FOLLY_ALLOW_TFO) && defined(TCP_FASTOPEN) && defined(MSG_FASTOPEN) +#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 { -#if FOLLY_ALLOW_TFO - /** - * tfo_sendto has the same semantics as sendto, but is used to + * tfo_sendto has the same semantics as sendmsg, but is used to * send with TFO data. */ -ssize_t tfo_sendto( - int sockfd, - const void* buf, - size_t len, - int flags, - const struct sockaddr* dest_addr, - socklen_t addlen); +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); -#endif + +/** + * Check if TFO succeeded in being used. + */ +bool tfo_succeeded(int sockfd); } }