about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2017-03-10 20:34:31 +0000
committerEric Wong <e@80x24.org>2017-03-14 20:08:06 +0000
commit4ce6b00f75f1584aff088f6b4e6b15488331e582 (patch)
tree7812e3f9ce468c4d52a2dea1ea26b4746b2d5c69 /lib
parentc0975d0c2faf0f9186399b452cc889ff9259eed6 (diff)
downloadunicorn-4ce6b00f75f1584aff088f6b4e6b15488331e582.tar.gz
On FreeBSD 10.3, the value of SO_KEEPALIVE returned by
getsockopt is 8, even when set to '1' via setsockopt.
Relax the test to only ensure the boolean value is
interpreted as "true".

Verified independently of Ruby using the following:
--------8<---------
    #include <sys/types.h>
    #include <sys/socket.h>
    #include <stdio.h>

static int err(const char *msg)
{
	perror(msg);
	return 1;
}

int main(void)
{
	int sv[2];
	int set = 1;
	int got;
	socklen_t len = (socklen_t)sizeof(int);
	int rc;

	rc = socketpair(PF_LOCAL, SOCK_STREAM, 0, sv);
	if (rc) return err("socketpair failed");

	rc = setsockopt(sv[0], SOL_SOCKET, SO_KEEPALIVE, &set, len);
	if (rc) return err("setsockopt failed");

	rc = getsockopt(sv[0], SOL_SOCKET, SO_KEEPALIVE, &got, &len);
	if (rc) return err("getsockopt failed");

	printf("got: %d\n", got);
	return 0;
}
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions