forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR-URL: nodejs#44149 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
- Loading branch information
Showing
5 changed files
with
74 additions
and
0 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Flags: --test-udp-no-try-send | ||
'use strict'; | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const dgram = require('dgram'); | ||
|
||
const socket = dgram.createSocket('udp4'); | ||
assert.strictEqual(socket.getSendQueueSize(), 0); | ||
assert.strictEqual(socket.getSendQueueCount(), 0); | ||
socket.close(); | ||
|
||
const server = dgram.createSocket('udp4'); | ||
const client = dgram.createSocket('udp4'); | ||
|
||
server.bind(0, common.mustCall(() => { | ||
client.connect(server.address().port, common.mustCall(() => { | ||
const data = 'hello'; | ||
client.send(data); | ||
client.send(data); | ||
// See uv__send in win/udp.c | ||
assert.strictEqual(client.getSendQueueSize(), | ||
common.isWindows ? 0 : data.length * 2); | ||
assert.strictEqual(client.getSendQueueCount(), 2); | ||
client.close(); | ||
server.close(); | ||
})); | ||
})); |