Merge remote branch 'origin/v0.6'
Conflicts: deps/v8/src/version.cc
This commit is contained in:
commit
c2d9e62f16
41
benchmark/next-tick-2.js
Normal file
41
benchmark/next-tick-2.js
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
// Copyright Joyent, Inc. and other Node contributors.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
// copy of this software and associated documentation files (the
|
||||||
|
// "Software"), to deal in the Software without restriction, including
|
||||||
|
// without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||||
|
// persons to whom the Software is furnished to do so, subject to the
|
||||||
|
// following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included
|
||||||
|
// in all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||||
|
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||||
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
var count = 2e6,
|
||||||
|
left = count,
|
||||||
|
start;
|
||||||
|
|
||||||
|
function onNextTick() {
|
||||||
|
if (--left) {
|
||||||
|
process.nextTick(onNextTick);
|
||||||
|
} else {
|
||||||
|
finalize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function finalize() {
|
||||||
|
var duration = (new Date()).getTime() - start,
|
||||||
|
ticksPerSec = count / duration * 1000;
|
||||||
|
console.log("nextTick callbacks per second: " + Math.round(ticksPerSec));
|
||||||
|
}
|
||||||
|
|
||||||
|
start = (new Date()).getTime();
|
||||||
|
process.nextTick(onNextTick);
|
@ -1,7 +1,8 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style type="text/css">
|
<meta charset="utf-8">
|
||||||
|
<style>
|
||||||
ul {
|
ul {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
@ -9,13 +10,12 @@
|
|||||||
</style>
|
</style>
|
||||||
<link type="image/x-icon" rel="icon" href="../favicon.ico">
|
<link type="image/x-icon" rel="icon" href="../favicon.ico">
|
||||||
<link type="image/x-icon" rel="shortcut icon" href="../favicon.ico">
|
<link type="image/x-icon" rel="shortcut icon" href="../favicon.ico">
|
||||||
<link type="text/css" rel="stylesheet" href="../pipe.css">
|
<link rel="stylesheet" href="../pipe.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../sh_vim-dark.css">
|
<link rel="stylesheet" href="../sh_vim-dark.css">
|
||||||
<link rel="alternate"
|
<link rel="alternate"
|
||||||
type="application/rss+xml"
|
type="application/rss+xml"
|
||||||
title="node blog"
|
title="node blog"
|
||||||
href="http://feeds.feedburner.com/nodejs/123123123">
|
href="http://feeds.feedburner.com/nodejs/123123123">
|
||||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
|
||||||
<title>node.js</title>
|
<title>node.js</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -109,16 +109,16 @@ console.log('Server running at http://127.0.0.1:1337/');</pre>
|
|||||||
is a <a href="trademark-policy.pdf">trademark of Joyent, Inc</a>.
|
is a <a href="trademark-policy.pdf">trademark of Joyent, Inc</a>.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript" src="../sh_main.js"></script>
|
<script src="../sh_main.js"></script>
|
||||||
<script type="text/javascript" src="../sh_javascript.min.js"></script>
|
<script src="../sh_javascript.min.js"></script>
|
||||||
<script type="text/javascript">highlight(undefined, undefined, 'pre');</script>
|
<script>highlight(undefined, undefined, 'pre');</script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
var gaJsHost = (("https:" == document.location.protocol) ?
|
var gaJsHost = (("https:" == document.location.protocol) ?
|
||||||
"https://ssl." : "http://www.");
|
"https://ssl." : "http://www.");
|
||||||
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
try {
|
try {
|
||||||
var pageTracker = _gat._getTracker("UA-10874194-2");
|
var pageTracker = _gat._getTracker("UA-10874194-2");
|
||||||
pageTracker._trackPageview();
|
pageTracker._trackPageview();
|
||||||
|
@ -88,4 +88,4 @@ the recently built module:
|
|||||||
console.log(addon.hello()); // 'world'
|
console.log(addon.hello()); // 'world'
|
||||||
|
|
||||||
For the moment, that is all the documentation on addons. Please see
|
For the moment, that is all the documentation on addons. Please see
|
||||||
<https://github.com/ry/node_postgres> for a real example.
|
<https://github.com/pietern/hiredis-node> for a real example.
|
||||||
|
@ -47,9 +47,10 @@ Example: this program that takes the sha1 sum of a file
|
|||||||
console.log(d + ' ' + filename);
|
console.log(d + ' ' + filename);
|
||||||
});
|
});
|
||||||
|
|
||||||
### hash.update(data)
|
### hash.update(data, input_encoding='binary')
|
||||||
|
|
||||||
Updates the hash content with the given `data`.
|
Updates the hash content with the given `data`, the encoding of which is given
|
||||||
|
in `input_encoding` and can be `'utf8'`, `'ascii'` or `'binary'`.
|
||||||
This can be called many times with new data as it is streamed.
|
This can be called many times with new data as it is streamed.
|
||||||
|
|
||||||
### hash.digest(encoding='binary')
|
### hash.digest(encoding='binary')
|
||||||
@ -255,4 +256,4 @@ Generates cryptographically strong pseudo-random data. Usage:
|
|||||||
console.log('Have %d bytes of random data: %s', buf.length, buf);
|
console.log('Have %d bytes of random data: %s', buf.length, buf);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
// handle error
|
// handle error
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style type="text/css">
|
<meta charset="utf-8">
|
||||||
|
<style>
|
||||||
ul {
|
ul {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js?ver=3.1.3'></script>
|
<script src="../sh_main.js"></script>
|
||||||
<script type="text/javascript" src="../sh_main.js"></script>
|
<script src="../sh_javascript.min.js"></script>
|
||||||
<script type="text/javascript" src="../sh_javascript.min.js"></script>
|
|
||||||
<link type="image/x-icon" rel="icon" href="../favicon.ico">
|
<link type="image/x-icon" rel="icon" href="../favicon.ico">
|
||||||
<link type="image/x-icon" rel="shortcut icon" href="../favicon.ico">
|
<link type="image/x-icon" rel="shortcut icon" href="../favicon.ico">
|
||||||
<link type="text/css" rel="stylesheet" href="../pipe.css">
|
<link type="text/css" rel="stylesheet" href="../pipe.css">
|
||||||
@ -18,7 +18,6 @@
|
|||||||
type="application/rss+xml"
|
type="application/rss+xml"
|
||||||
title="node blog"
|
title="node blog"
|
||||||
href="http://feeds.feedburner.com/nodejs/123123123">
|
href="http://feeds.feedburner.com/nodejs/123123123">
|
||||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
|
||||||
<title>node.js</title>
|
<title>node.js</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -148,16 +147,16 @@
|
|||||||
is a <a href="trademark-policy.pdf">trademark of Joyent, Inc</a>.
|
is a <a href="trademark-policy.pdf">trademark of Joyent, Inc</a>.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
var gaJsHost = (("https:" == document.location.protocol) ?
|
var gaJsHost = (("https:" == document.location.protocol) ?
|
||||||
"https://ssl." : "http://www.");
|
"https://ssl." : "http://www.");
|
||||||
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
try {
|
try {
|
||||||
var pageTracker = _gat._getTracker("UA-10874194-2");
|
var pageTracker = _gat._getTracker("UA-10874194-2");
|
||||||
pageTracker._trackPageview();
|
pageTracker._trackPageview();
|
||||||
} catch(err) {}
|
} catch(err) {}
|
||||||
</script>
|
</script>
|
||||||
|
</body>
|
||||||
</body></html>
|
</html>
|
@ -1,7 +1,8 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<style type="text/css">
|
<meta charset="utf-8">
|
||||||
|
<style>
|
||||||
ul {
|
ul {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
@ -9,13 +10,12 @@
|
|||||||
</style>
|
</style>
|
||||||
<link type="image/x-icon" rel="icon" href="favicon.ico">
|
<link type="image/x-icon" rel="icon" href="favicon.ico">
|
||||||
<link type="image/x-icon" rel="shortcut icon" href="favicon.ico">
|
<link type="image/x-icon" rel="shortcut icon" href="favicon.ico">
|
||||||
<link type="text/css" rel="stylesheet" href="pipe.css">
|
<link rel="stylesheet" href="pipe.css">
|
||||||
<link type="text/css" rel="stylesheet" href="sh_vim-dark.css">
|
<link rel="stylesheet" href="sh_vim-dark.css">
|
||||||
<link rel="alternate"
|
<link rel="alternate"
|
||||||
type="application/rss+xml"
|
type="application/rss+xml"
|
||||||
title="node blog"
|
title="node blog"
|
||||||
href="http://feeds.feedburner.com/nodejs/123123123">
|
href="http://feeds.feedburner.com/nodejs/123123123">
|
||||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
|
||||||
<title>node.js</title>
|
<title>node.js</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -200,16 +200,16 @@ server.listen(1337, "127.0.0.1");</pre>
|
|||||||
is a <a href="trademark-policy.pdf">trademark of Joyent, Inc</a>.
|
is a <a href="trademark-policy.pdf">trademark of Joyent, Inc</a>.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript" src="sh_main.js"></script>
|
<script src="sh_main.js"></script>
|
||||||
<script type="text/javascript" src="sh_javascript.min.js"></script>
|
<script src="sh_javascript.min.js"></script>
|
||||||
<script type="text/javascript">highlight(undefined, undefined, 'pre');</script>
|
<script>highlight(undefined, undefined, 'pre');</script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
var gaJsHost = (("https:" == document.location.protocol) ?
|
var gaJsHost = (("https:" == document.location.protocol) ?
|
||||||
"https://ssl." : "http://www.");
|
"https://ssl." : "http://www.");
|
||||||
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
try {
|
try {
|
||||||
var pageTracker = _gat._getTracker("UA-10874194-2");
|
var pageTracker = _gat._getTracker("UA-10874194-2");
|
||||||
pageTracker._trackPageview();
|
pageTracker._trackPageview();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="utf-8">
|
||||||
<title>{{section}}Node.js v0.6.6 Manual & Documentation</title>
|
<title>{{section}}Node.js v0.6.6 Manual & Documentation</title>
|
||||||
<link rel="stylesheet" href="assets/style.css">
|
<link rel="stylesheet" href="assets/style.css">
|
||||||
<link rel="stylesheet" href="assets/sh.css">
|
<link rel="stylesheet" href="assets/sh.css">
|
||||||
@ -21,16 +21,15 @@
|
|||||||
<script src="assets/sh_main.js"></script>
|
<script src="assets/sh_main.js"></script>
|
||||||
<script src="assets/sh_javascript.min.js"></script>
|
<script src="assets/sh_javascript.min.js"></script>
|
||||||
<script>highlight(undefined, undefined, 'pre');</script>
|
<script>highlight(undefined, undefined, 'pre');</script>
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
var gaJsHost = (("https:" == document.location.protocol) ?
|
var gaJsHost = (("https:" == document.location.protocol) ?
|
||||||
"https://ssl." : "http://www.");
|
"https://ssl." : "http://www.");
|
||||||
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
try {
|
try {
|
||||||
var pageTracker = _gat._getTracker("UA-10874194-2");
|
var pageTracker = _gat._getTracker("UA-10874194-2");
|
||||||
pageTracker._trackPageview();
|
pageTracker._trackPageview();
|
||||||
} catch(err) {}</script>
|
} catch(err) {}</script>
|
||||||
<script type="text/javascript">highlight(undefined, undefined, 'pre');</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -698,7 +698,7 @@ Buffer.prototype.readInt8 = function(offset, noAssert) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function readInt16(buffer, offset, isBigEndian, noAssert) {
|
function readInt16(buffer, offset, isBigEndian, noAssert) {
|
||||||
var neg;
|
var neg, val;
|
||||||
|
|
||||||
if (!noAssert) {
|
if (!noAssert) {
|
||||||
assert.ok(typeof (isBigEndian) === 'boolean',
|
assert.ok(typeof (isBigEndian) === 'boolean',
|
||||||
@ -729,7 +729,7 @@ Buffer.prototype.readInt16BE = function(offset, noAssert) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function readInt32(buffer, offset, isBigEndian, noAssert) {
|
function readInt32(buffer, offset, isBigEndian, noAssert) {
|
||||||
var neg;
|
var neg, val;
|
||||||
|
|
||||||
if (!noAssert) {
|
if (!noAssert) {
|
||||||
assert.ok(typeof (isBigEndian) === 'boolean',
|
assert.ok(typeof (isBigEndian) === 'boolean',
|
||||||
|
@ -443,6 +443,8 @@ Socket.prototype.write = function(data, arg1, arg2) {
|
|||||||
Socket.prototype._write = function(data, encoding, cb) {
|
Socket.prototype._write = function(data, encoding, cb) {
|
||||||
timers.active(this);
|
timers.active(this);
|
||||||
|
|
||||||
|
if (!this._handle) throw new Error('This socket is closed.');
|
||||||
|
|
||||||
// `encoding` is unused right now, `data` is always a buffer.
|
// `encoding` is unused right now, `data` is always a buffer.
|
||||||
var writeReq = this._handle.write(data);
|
var writeReq = this._handle.write(data);
|
||||||
|
|
||||||
|
@ -108,8 +108,8 @@ var unenroll = exports.unenroll = function(item) {
|
|||||||
list.close();
|
list.close();
|
||||||
delete lists[item._idleTimeout];
|
delete lists[item._idleTimeout];
|
||||||
}
|
}
|
||||||
//if active is called later, then we want to make sure not to insert again
|
// if active is called later, then we want to make sure not to insert again
|
||||||
delete item._idleTimeout;
|
item._idleTimeout = -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -151,17 +151,18 @@ exports.setTimeout = function(callback, after) {
|
|||||||
if (after <= 0) {
|
if (after <= 0) {
|
||||||
// Use the slow case for after == 0
|
// Use the slow case for after == 0
|
||||||
timer = new Timer();
|
timer = new Timer();
|
||||||
|
timer._callback = callback;
|
||||||
|
|
||||||
if (arguments.length <= 2) {
|
if (arguments.length <= 2) {
|
||||||
timer._onTimeout = function() {
|
timer._onTimeout = function() {
|
||||||
callback();
|
this._callback();
|
||||||
timer.close();
|
this.close();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var args = Array.prototype.slice.call(arguments, 2);
|
var args = Array.prototype.slice.call(arguments, 2);
|
||||||
timer._onTimeout = function() {
|
timer._onTimeout = function() {
|
||||||
callback.apply(timer, args);
|
this._callback.apply(timer, args);
|
||||||
timer.close();
|
this.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
49
test/simple/test-net-write-after-close.js
Normal file
49
test/simple/test-net-write-after-close.js
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
// Copyright Joyent, Inc. and other Node contributors.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
// copy of this software and associated documentation files (the
|
||||||
|
// "Software"), to deal in the Software without restriction, including
|
||||||
|
// without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||||
|
// persons to whom the Software is furnished to do so, subject to the
|
||||||
|
// following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included
|
||||||
|
// in all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||||
|
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||||
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
var common = require('../common');
|
||||||
|
var assert = require('assert');
|
||||||
|
var net = require('net');
|
||||||
|
|
||||||
|
var gotError = false;
|
||||||
|
|
||||||
|
process.on('exit', function() {
|
||||||
|
assert(gotError);
|
||||||
|
});
|
||||||
|
|
||||||
|
var server = net.createServer(function(socket) {
|
||||||
|
setTimeout(function() {
|
||||||
|
assert.throws(
|
||||||
|
function() {
|
||||||
|
socket.write('test');
|
||||||
|
},
|
||||||
|
/This socket is closed/
|
||||||
|
);
|
||||||
|
server.close();
|
||||||
|
gotError = true;
|
||||||
|
}, 250);
|
||||||
|
});
|
||||||
|
|
||||||
|
server.listen(common.PORT, function() {
|
||||||
|
var client = net.connect(common.PORT, function() {
|
||||||
|
client.end();
|
||||||
|
});
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user