-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: fix tls-inception #4195
test: fix tls-inception #4195
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,10 +12,9 @@ var fs = require('fs'); | |
var path = require('path'); | ||
var net = require('net'); | ||
|
||
var options, a, b, portA, portB; | ||
var gotHello = false; | ||
var options, a, b; | ||
|
||
var body = new Buffer(4000).fill('A'); | ||
var body = new Buffer(400000).fill('A'); | ||
|
||
options = { | ||
key: fs.readFileSync(path.join(common.fixturesDir, 'test_key.pem')), | ||
|
@@ -33,7 +32,7 @@ a = tls.createServer(options, function(socket) { | |
dest.pipe(socket); | ||
socket.pipe(dest); | ||
|
||
dest.on('close', function() { | ||
dest.on('end', function() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reason? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've tried to explain it the best I can (from my understanding) in the commit log: santigimeno@432a86e
Running the test with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are two ways to EOF for TLS connection: TCP FIN packet, and TLS close_notify alert (i.o.w. shutdown). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. Thanks for the explanation! |
||
socket.destroy(); | ||
}); | ||
}); | ||
|
@@ -43,10 +42,6 @@ b = tls.createServer(options, function(socket) { | |
socket.end(body); | ||
}); | ||
|
||
process.on('exit', function() { | ||
assert(gotHello); | ||
}); | ||
|
||
a.listen(common.PORT, function() { | ||
b.listen(common.PORT + 1, function() { | ||
options = { | ||
|
@@ -62,15 +57,14 @@ a.listen(common.PORT, function() { | |
}); | ||
ssl.setEncoding('utf8'); | ||
var buf = ''; | ||
ssl.once('data', function(data) { | ||
ssl.on('data', function(data) { | ||
buf += data; | ||
gotHello = true; | ||
}); | ||
ssl.on('end', function() { | ||
ssl.on('end', common.mustCall(function() { | ||
assert.equal(buf, body); | ||
ssl.end(); | ||
a.close(); | ||
b.close(); | ||
}); | ||
})); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a bit over the top, probably? What do you think about a compromise with a
40000
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've used that value to reproduce the
ECONNRESET
error inOS X
consistently.