Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c4c0d9
commit 8189e05
Showing
7 changed files
with
330 additions
and
11 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Attempt to verify that connections can make use of TCP_FASTOPEN | ||
|
||
(function() { | ||
'use strict'; | ||
|
||
// Does it make sense to expect TFO support? | ||
try { | ||
// Both client and server bits must be set to run this test. | ||
const val = cat("/proc/sys/net/ipv4/tcp_fastopen"); | ||
if ((Number.parseInt(val) & 3) != 3) { | ||
print("==Skipping test, tcp_fastopen not enabled: " + val); | ||
return; | ||
} | ||
} catch (e) { | ||
// File not found or unreadable, assume no TFO support. | ||
print("==Skipping test, unable to read /proc/sys/net/ipv4/tcp_fastopen"); | ||
return; | ||
} | ||
|
||
const tcpFastOpen = db.serverStatus().network.tcpFastOpen; | ||
printjson(tcpFastOpen); | ||
|
||
const confused = "proc file suggests this kernel is capable, but setsockopt failed"; | ||
assert.eq(true, tcpFastOpen.serverSupported, confused); | ||
assert.eq(true, tcpFastOpen.clientSupported, confused); | ||
|
||
const countBefore = tcpFastOpen.accepted; | ||
|
||
const netConn = runMongoProgram('mongo', '--port', myPort(), '--eval', ';'); | ||
assert.eq(0, netConn); | ||
|
||
const countAfter = db.serverStatus().network.tcpFastOpen.accepted; | ||
assert.gt(countAfter, countBefore, "Second connection did not trigger TFO"); | ||
})(); |
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
Oops, something went wrong.