Commit: ec2a132f9c345e6b40d04f7230d25b2fe5659672 Author: Igor Wiedler <i...@wiedler.ch> Sun, 2 Sep 2012 23:18:45 +0200 Parents: 7552a7eb191b477349fa278e50fa8b3858382535 Branches: PHP-5.4
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ec2a132f9c345e6b40d04f7230d25b2fe5659672 Log: Bug #49341: Add SO_REUSEPORT support for socket_set_option() This is a BSD-only feature, and it will only be available on BSD. On other platforms the constant will simply not be set. Bugs: https://bugs.php.net/49341 Changed paths: M ext/sockets/sockets.c A ext/sockets/tests/bug49341.phpt Diff: diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index 0d17142..d6ee418 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -788,6 +788,9 @@ PHP_MINIT_FUNCTION(sockets) #endif REGISTER_LONG_CONSTANT("SO_DEBUG", SO_DEBUG, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SO_REUSEADDR", SO_REUSEADDR, CONST_CS | CONST_PERSISTENT); +#ifdef SO_REUSEPORT + REGISTER_LONG_CONSTANT("SO_REUSEPORT", SO_REUSEPORT, CONST_CS | CONST_PERSISTENT); +#endif REGISTER_LONG_CONSTANT("SO_KEEPALIVE", SO_KEEPALIVE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SO_DONTROUTE", SO_DONTROUTE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SO_LINGER", SO_LINGER, CONST_CS | CONST_PERSISTENT); diff --git a/ext/sockets/tests/bug49341.phpt b/ext/sockets/tests/bug49341.phpt new file mode 100644 index 0000000..c165ac7 --- /dev/null +++ b/ext/sockets/tests/bug49341.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #49341: add SO_REUSEPORT support for socket_set_option() +--SKIPIF-- +<?php +if (!extension_loaded('sockets')) { + die('skip sockets extension not available.'); +} +if (PHP_OS !== 'Darwin' && false === strpos(PHP_OS, 'BSD')) { + die('is not *BSD.'); +} +--FILE-- +<?php +var_dump(defined('SO_REUSEPORT')); +--EXPECTF-- +bool(true) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php