From: Woo Xie <woo@fb.com>
Date: Mon, 8 Jun 2015 19:24:46 +0000 (-0700)
Subject: fix the compling error caused by tcpinfo of low version
X-Git-Tag: v0.45.0~8
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=64f036b4965a0338d5ff7e30cd673982d993848d;p=folly.git

fix the compling error caused by tcpinfo of low version

Summary: my D2097198 break the project relying on old glibc

Test Plan: compling

Reviewed By: wez@fb.com

Subscribers: trunkagent, fugalh, folly-diffs@, jsedgwick, yfeldblum, chalfant

FB internal diff: D2135297

Tasks: 7283522

Signature: t1:2135297:1433791259:8b82b8d9b16da32be54c0dff1214fa20c94840e2
---

diff --git a/folly/wangle/acceptor/TransportInfo.cpp b/folly/wangle/acceptor/TransportInfo.cpp
index 16fd8094..6c7dc75b 100644
--- a/folly/wangle/acceptor/TransportInfo.cpp
+++ b/folly/wangle/acceptor/TransportInfo.cpp
@@ -31,6 +31,7 @@ bool TransportInfo::initWithSocket(const AsyncSocket* sock) {
    * available in current tcpinfo.  To workaround this limitation, totalBytes
    * and MSS are used to estimate it.
    */
+#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 17
   if (tcpinfo.tcpi_total_retrans == 0) {
     rtx = 0;
   } else if (tcpinfo.tcpi_total_retrans > 0 && tcpinfo.tcpi_snd_mss > 0 &&
@@ -42,6 +43,9 @@ bool TransportInfo::initWithSocket(const AsyncSocket* sock) {
   } else {
     rtx = -1;
   }
+#else
+    rtx = -1;
+#endif  // __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 17
   validTcpinfo = true;
 #else
   tcpinfoErrno = EINVAL;