summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-10-02 23:26:51 +0200
committerRich Trott <rtrott@gmail.com>2019-10-05 17:48:10 -0700
commitafdc3d0d187e4e3a336937df17a4c90092405e2a (patch)
treef16e7b4920a24d3ed7e711380450bd8b302ee40b /test
parent28c3a9dd723e124a0e38588826c737eee7bfded5 (diff)
downloadandroid-node-v8-afdc3d0d187e4e3a336937df17a4c90092405e2a.tar.gz
android-node-v8-afdc3d0d187e4e3a336937df17a4c90092405e2a.tar.bz2
android-node-v8-afdc3d0d187e4e3a336937df17a4c90092405e2a.zip
dgram: use `uv_udp_try_send()`
This improves dgram performance by avoiding unnecessary async operations. One issue with this commit is that it seems hard to actually create conditions under which the fallback path to the async case is actually taken, for all supported OS, so an internal CLI option is used for testing that path. Another caveat is that the lack of an async operation means that there are slight timing differences (essentially `nextTick()` rather than `setImmediate()` for the send callback). PR-URL: https://github.com/nodejs/node/pull/29832 Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'test')
-rw-r--r--test/async-hooks/test-udpsendwrap.js1
-rw-r--r--test/parallel/test-dgram-send-callback-recursive.js2
-rw-r--r--test/sequential/test-async-wrap-getasyncid.js2
3 files changed, 3 insertions, 2 deletions
diff --git a/test/async-hooks/test-udpsendwrap.js b/test/async-hooks/test-udpsendwrap.js
index 25b7eb6103..f1403e3226 100644
--- a/test/async-hooks/test-udpsendwrap.js
+++ b/test/async-hooks/test-udpsendwrap.js
@@ -1,3 +1,4 @@
+// Flags: --test-udp-no-try-send
'use strict';
const common = require('../common');
diff --git a/test/parallel/test-dgram-send-callback-recursive.js b/test/parallel/test-dgram-send-callback-recursive.js
index 835fa332df..1a4c7c84fc 100644
--- a/test/parallel/test-dgram-send-callback-recursive.js
+++ b/test/parallel/test-dgram-send-callback-recursive.js
@@ -22,7 +22,7 @@ function onsend() {
client.on('listening', function() {
port = this.address().port;
- setImmediate(function() {
+ process.nextTick(() => {
async = true;
});
diff --git a/test/sequential/test-async-wrap-getasyncid.js b/test/sequential/test-async-wrap-getasyncid.js
index f2702b4b49..bef6b050ff 100644
--- a/test/sequential/test-async-wrap-getasyncid.js
+++ b/test/sequential/test-async-wrap-getasyncid.js
@@ -1,5 +1,5 @@
'use strict';
-// Flags: --expose-gc --expose-internals --no-warnings
+// Flags: --expose-gc --expose-internals --no-warnings --test-udp-no-try-send
const common = require('../common');
const { internalBinding } = require('internal/test/binding');