Merge remote-tracking branch 'upstream/v0.10'
Conflicts: src/node_crypto.cc test/simple/test-crypto.js
This commit is contained in:
commit
c37e1b7c4b
@ -281,3 +281,23 @@ line interface:
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
## readline.cursorTo(stream, x, y)
|
||||
|
||||
Move cursor to the specified position in a given TTY stream.
|
||||
|
||||
## readline.moveCursor(stream, dx, dy)
|
||||
|
||||
Move cursor relative to it's current position in a given TTY stream.
|
||||
|
||||
## readline.clearLine(stream, dir)
|
||||
|
||||
Clears current line of given TTY stream in a specified direction.
|
||||
`dir` should have one of following values:
|
||||
|
||||
* `-1` - to the left from cursor
|
||||
* `1` - to the right from cursor
|
||||
* `0` - the entire line
|
||||
|
||||
## readline.clearScreenDown(stream)
|
||||
|
||||
Clears the screen from the current position of the cursor down.
|
||||
|
@ -461,8 +461,11 @@ Socket.prototype._destroy = function(exception, cb) {
|
||||
this._handle = null;
|
||||
}
|
||||
|
||||
fireErrorCallbacks();
|
||||
// we set destroyed to true before firing error callbacks in order
|
||||
// to make it re-entrance safe in case Socket.prototype.destroy()
|
||||
// is called within callbacks
|
||||
this.destroyed = true;
|
||||
fireErrorCallbacks();
|
||||
|
||||
if (this.server) {
|
||||
COUNTER_NET_SERVER_CONNECTION_CLOSE(this);
|
||||
@ -829,6 +832,7 @@ Socket.prototype.connect = function(options, cb) {
|
||||
if (this.destroyed) {
|
||||
this._readableState.reading = false;
|
||||
this._readableState.ended = false;
|
||||
this._readableState.endEmitted = false;
|
||||
this._writableState.ended = false;
|
||||
this._writableState.ending = false;
|
||||
this._writableState.finished = false;
|
||||
|
@ -1022,5 +1022,18 @@ assert.throws(function() {
|
||||
crypto.createVerify('RSA-SHA1').update('0', 'hex');
|
||||
}, /Bad input string/);
|
||||
|
||||
assert.throws(function() {
|
||||
var private = [
|
||||
'-----BEGIN RSA PRIVATE KEY-----',
|
||||
'MIGrAgEAAiEA+3z+1QNF2/unumadiwEr+C5vfhezsb3hp4jAnCNRpPcCAwEAAQIgQNriSQK4',
|
||||
'EFwczDhMZp2dvbcz7OUUyt36z3S4usFPHSECEQD/41K7SujrstBfoCPzwC1xAhEA+5kt4BJy',
|
||||
'eKN7LggbF3Dk5wIQN6SL+fQ5H/+7NgARsVBp0QIRANxYRukavs4QvuyNhMx+vrkCEQCbf6j/',
|
||||
'Ig6/HueCK/0Jkmp+',
|
||||
'-----END RSA PRIVATE KEY-----',
|
||||
''
|
||||
].join('\n');
|
||||
crypto.createSign('RSA-SHA256').update('test').sign(private);
|
||||
}, /RSA_sign:digest too big for rsa key/);
|
||||
|
||||
// Make sure memory isn't released before being returned
|
||||
console.log(crypto.randomBytes(16));
|
||||
|
@ -27,6 +27,7 @@ var net = require('net');
|
||||
var N = 50;
|
||||
var c = 0;
|
||||
var client_recv_count = 0;
|
||||
var client_end_count = 0;
|
||||
var disconnect_count = 0;
|
||||
|
||||
var server = net.createServer(function(socket) {
|
||||
@ -67,6 +68,7 @@ server.listen(common.PORT, function() {
|
||||
|
||||
client.on('end', function() {
|
||||
console.error('CLIENT end');
|
||||
client_end_count++;
|
||||
});
|
||||
|
||||
client.on('close', function(had_error) {
|
||||
@ -82,5 +84,6 @@ server.listen(common.PORT, function() {
|
||||
process.on('exit', function() {
|
||||
assert.equal(N + 1, disconnect_count);
|
||||
assert.equal(N + 1, client_recv_count);
|
||||
assert.equal(N + 1, client_end_count);
|
||||
});
|
||||
|
||||
|
@ -37,3 +37,36 @@ s.destroy();
|
||||
assert.equal(9, s.server.connections);
|
||||
s.destroy();
|
||||
assert.equal(9, s.server.connections);
|
||||
|
||||
var SIZE = 2E6;
|
||||
var N = 10;
|
||||
var buf = new Buffer(SIZE);
|
||||
buf.fill(0x61); // 'a'
|
||||
|
||||
var server = net.createServer(function(socket) {
|
||||
socket.setNoDelay();
|
||||
|
||||
socket.on('error', function(err) {
|
||||
socket.destroy();
|
||||
}).on('close', function() {
|
||||
server.close();
|
||||
})
|
||||
|
||||
for (var i = 0; i < N; ++i) {
|
||||
socket.write(buf, function() { });
|
||||
}
|
||||
socket.end();
|
||||
|
||||
}).listen(common.PORT, function() {
|
||||
var conn = net.connect(common.PORT);
|
||||
conn.on('data', function(buf) {
|
||||
conn.pause();
|
||||
setTimeout(function() {
|
||||
conn.destroy();
|
||||
}, 20);
|
||||
});
|
||||
});
|
||||
|
||||
process.on('exit', function() {
|
||||
assert.equal(server.connections, 0);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user