Implement and turn on the osnet demux

This change introduces a demux that uses the kernel's network stack for UDP
datagram-to-socket assignment based on packet source address (as opposed to the
forwarding strategy of the routing demux). The osnet demux is used by default
on non-Windows platforms. When possible, use of the osnet demux is preferred
over the routing demux, since it can be expected to perform better.

The unit test suite has been extended to run all tests first with the demux
selected by default for the current platform, and then with the routing demux,
if the latter differs from the former. Tests were already being run twice, first
with IPv4 and then with IPv6, and thus we now run each test four times on
Linux, twice on Windows.

All unit tests pass with both demux types.
This commit is contained in:
Ray Brown committed 2012-11-27 21:33:09 -08:00
1 parent ca32b91a9c
commit 77a50c7382
5 files changed
+134 -44

No files matched your search

+12 -8
View File
@@ -22,7 +22,7 @@ from SimpleHTTPServer import SimpleHTTPRequestHandler
from collections import OrderedDict
import ssl
from dtls import do_patch
from dtls import do_patch, force_routing_demux, reset_default_demux
HOST = "localhost"
CONNECTION_TIMEOUT = datetime.timedelta(seconds=30)
@@ -1347,14 +1347,18 @@ def test_main(verbose=True):
raise Exception("Can't read certificate files!")
TestSupport.verbose = verbose
reset_default_demux()
do_patch()
AF_INET4_6 = socket.AF_INET
res = unittest.main(exit=False).result.wasSuccessful()
if not res:
print "IPv4 test suite failed; not proceeding to IPv6"
sys.exit(not res)
AF_INET4_6 = socket.AF_INET6
unittest.main()
for demux in "platform-native", "routing":
for AF_INET4_6 in socket.AF_INET, socket.AF_INET6:
print "Suite run: demux: %s, protocol: %d" % (demux, AF_INET4_6)
res = unittest.main(exit=False).result.wasSuccessful()
if not res:
print "Suite run failed: demux: %s, protocol: %d" % (
demux, AF_INET4_6)
sys.exit(True)
if not force_routing_demux():
break
if __name__ == "__main__":
verbose = True if len(sys.argv) > 1 and sys.argv[1] == "-v" else False