-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ext/sockets: Adding TCP_FUNCTION_BLK socket option for FreeBSD.
Allows to select an alternate TCP stack. For example with RACK, a fast loss detection relying on timestamp per packet. While it works system-wide, it can also apply in an individual socket level too. close GH-16842
- Loading branch information
Showing
6 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--TEST-- | ||
Test if socket_set_option() works, option:TCP_FUNCTION_BLK | ||
--EXTENSIONS-- | ||
sockets | ||
--SKIPIF-- | ||
<?php | ||
|
||
if (!defined("TCP_FUNCTION_BLK")) { | ||
die('SKIP on platforms not supporting TCP_FUNCTION_BLK'); | ||
} | ||
?> | ||
--FILE-- | ||
<?php | ||
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); | ||
|
||
if (!$socket) { | ||
die('Unable to create AF_INET socket [socket]'); | ||
} | ||
socket_set_option( $socket, SOL_TCP, TCP_FUNCTION_BLK, "nochancetoexist"); | ||
// TCP/RACK and other alternate stacks are not present by default, at least `freebsd` is. | ||
var_dump(socket_set_option( $socket, SOL_TCP, TCP_FUNCTION_BLK, "freebsd")); | ||
var_dump(socket_get_option( $socket, SOL_TCP, TCP_FUNCTION_BLK)); | ||
socket_close($socket); | ||
?> | ||
--EXPECTF-- | ||
Warning: socket_set_option(): Unable to set socket option [2]: No such file or directory in %s on line %d | ||
bool(true) | ||
array(2) { | ||
["function_set_name"]=> | ||
string(7) "freebsd" | ||
["pcbcnt"]=> | ||
int(%d) | ||
} |