When calling .close() on a server that is listening on a socket rather than a 
TCP port
the socket is not unlinked from the file-system - it remains in place. As a 
result
subsequent attempts to use the same socket will fail with EADDRINUSE.

Several tests in the suite make use of common.PIPE and this causes all but the 
first to
fail with EADDRINUSE.

One option would be to add code to each test that manually unlinks the socket 
on exit but
it makes more sense to put the functionality into the common module. As each 
test does
require('common') very early on it makes sense to detect an existing socket and 
unlink it
at this point.

Signed-off-by: TJ <[email protected]>
---
 test/common.js | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/test/common.js b/test/common.js
index 7b4c0bc..4cbdea6 100644
--- a/test/common.js
+++ b/test/common.js
@@ -59,6 +59,10 @@ if (process.platform === 'win32') {
   exports.PIPE = exports.tmpDir + '/test.sock';
 }
 +// node doesn't unlink sockets when server.close() is called so do it manually
+if (fs.existsSync(exports.PIPE))
+  fs.unlinkSync(exports.PIPE);
+
 var util = require('util');
 for (var i in util) exports[i] = util[i];
 //for (var i in exports) global[i] = exports[i];
-- 
1.8.1.2.433.g9808ce0.dirty

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to