-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR-URL: #44149 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
- Loading branch information
1 parent
c708d9b
commit 33707dc
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(); | ||
})); | ||
})); |