http_request: support proposed Raindrops::TCP states on non-Linux
commit73769bc0bc309382689707595f57388ea5e5c737
authorEric Wong <e@80x24.org>
Tue, 21 Mar 2017 02:32:27 +0000 (21 02:32 +0000)
committerEric Wong <e@80x24.org>
Tue, 21 Mar 2017 02:45:17 +0000 (21 02:45 +0000)
treea2dd4ae86edd2201d8d57d704ba0b0a0dec2613d
parent20c66dbf1ebd0ca993e7a79c9d0d833d747df358
http_request: support proposed Raindrops::TCP states on non-Linux

raindrops 0.18+ will have Raindrops::TCP state hash for portable
mapping of TCP states to their respective numeric values.  This
was necessary because TCP state numbers (and even macro names)
differ between FreeBSD and Linux (and possibly other OSes).

Favor using the Raindrops::TCP state hash if available, but
fall back to the hard-coded values since older versions of
raindrops did not support TCP_INFO on non-Linux systems.

While we're in the area, favor "const_defined?" over "defined?"
to reduce the inline constant cache footprint for branches
which are only evaluated once.

Patches to implement Raindrops::TCP for FreeBSD are available at:

  https://bogomips.org/raindrops-public/20170316031652.17433-1-e@80x24.org/T/
lib/unicorn/http_request.rb