Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save piscisaureus/522208 to your computer and use it in GitHub Desktop.
Save piscisaureus/522208 to your computer and use it in GitHub Desktop.
From 2f38fce7e4346c88ea7f3d72eb27608a029018a8 Mon Sep 17 00:00:00 2001
From: Bert Belder <[email protected]>
Date: Fri, 13 Aug 2010 05:23:41 +0200
Subject: [PATCH] One more test with a race condition fixed
---
test/simple/test-http-eof-on-connect.js | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/test/simple/test-http-eof-on-connect.js b/test/simple/test-http-eof-on-connect.js
index 4fd7875..34d8af0 100644
--- a/test/simple/test-http-eof-on-connect.js
+++ b/test/simple/test-http-eof-on-connect.js
@@ -7,11 +7,13 @@ http = require("http");
// It is separate from test-http-malformed-request.js because it is only
// reproduceable on the first packet on the first connection to a server.
-server = http.createServer(function (req, res) {});
+var server = http.createServer(function (req, res) {});
server.listen(common.PORT);
-net.createConnection(common.PORT).addListener("connect", function () {
- this.close();
-}).addListener("close", function () {
- server.close();
-});
+server.addListener("listening", function() {
+ net.createConnection(common.PORT).addListener("connect", function () {
+ this.close();
+ }).addListener("close", function () {
+ server.close();
+ });
+});
\ No newline at end of file
--
1.7.0.2.msysgit.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment