skytools.set_tcp_keepalive: add compat with newer OSX
authorMarko Kreen <markokr@gmail.com>
Tue, 5 Nov 2013 23:28:31 +0000 (01:28 +0200)
committerMarko Kreen <markokr@gmail.com>
Tue, 5 Nov 2013 23:28:31 +0000 (01:28 +0200)
commitcf685818175516a891340b800a2afa9b080c700d
treea7851a2b895b2d147b8ea57a78173612cb2dbe55
parentd1f6961c8d31ed1c34ac0e3a7dedc1c6703d032f
skytools.set_tcp_keepalive: add compat with newer OSX

Newer OSX has Linux-style TCP_KEEPIDLE/TCP_KEEPCNT
socket options, but TCP_KEEPIDLE is missing, instead
it has old well-hidden TCP_KEEPALIVE option.  So it
branches into Linux section and fails there.

This patch detects every Linux option separately
and uses TCP_KEEPALIVE instead TCP_KEEPIDLE
on Darwin.

It does expect that Python is compiled against current
OSX versions, and headers match running kernel.  So if
option is defined in 'socket' module, it works.

Reported-by: Rob Fowler
python/skytools/sockutil.py