Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
avoid pipe conflict
  • Loading branch information
joyeecheung committed Mar 10, 2017
commit 2b7354cf95743b67bebe64b8147311ae28b90f01
3 changes: 2 additions & 1 deletion test/parallel/test-net-server-listen-handle.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ function closePipeServer(handle) {

let counter = 0;

// Avoid conflict with listen-path
function randomPipePath() {
return common.PIPE + '-listen-pipe-' + (counter++);
return common.PIPE + '-listen-handle-' + (counter++);
}

function randomHandle(type) {
Expand Down
20 changes: 14 additions & 6 deletions test/parallel/test-net-server-listen-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,48 @@

const common = require('../common');
const net = require('net');
function close() { this.close(); }

common.refreshTmpDir();

function closeServer() {
return common.mustCall(function() {
this.close();
});
}

let counter = 0;

// Avoid conflict with listen-handle
function randomPipePath() {
return common.PIPE + '-listen-pipe-' + (counter++);
return common.PIPE + '-listen-path-' + (counter++);
}

// Test listen(path)
{
const handlePath = randomPipePath();
net.createServer()
.listen(handlePath)
.on('listening', common.mustCall(close));
.on('listening', closeServer());
}

// Test listen({path})
{
const handlePath = randomPipePath();
net.createServer()
.listen({path: handlePath})
.on('listening', common.mustCall(close));
.on('listening', closeServer());
}

// Test listen(path, cb)
{
const handlePath = randomPipePath();
net.createServer()
.listen(handlePath, common.mustCall(close));
.listen(handlePath, closeServer());
}

// Test listen(path, cb)
{
const handlePath = randomPipePath();
net.createServer()
.listen({path: handlePath}, common.mustCall(close));
.listen({path: handlePath}, closeServer());
}