fix the compling error caused by tcpinfo of low version
authorWoo Xie <woo@fb.com>
Mon, 8 Jun 2015 19:24:46 +0000 (12:24 -0700)
committerSara Golemon <sgolemon@fb.com>
Tue, 9 Jun 2015 20:21:21 +0000 (13:21 -0700)
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

folly/wangle/acceptor/TransportInfo.cpp

index 16fd80944a4855329f6c4c71f6811a97cae2545e..6c7dc75b6cb63c73c7775d774913a56972748359 100644 (file)
@@ -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;