Browse Source

Merge remote branch 'origin/v0.6'

Conflicts:
	deps/v8/src/version.cc
v0.7.4-release
Ryan Dahl 13 years ago
parent
commit
c2d9e62f16
  1. 41
      benchmark/next-tick-2.js
  2. 18
      doc/about/index.html
  3. 2
      doc/api/addons.markdown
  4. 7
      doc/api/crypto.markdown
  5. 17
      doc/community/index.html
  6. 20
      doc/index.html
  7. 11
      doc/template.html
  8. 4
      lib/buffer.js
  9. 2
      lib/net.js
  10. 13
      lib/timers.js
  11. 49
      test/simple/test-net-write-after-close.js

41
benchmark/next-tick-2.js

@ -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);

18
doc/about/index.html

@ -1,7 +1,8 @@
<!doctype html>
<html>
<head>
<style type="text/css">
<meta charset="utf-8">
<style>
ul {
padding: 0;
margin: 0;
@ -9,13 +10,12 @@
</style>
<link type="image/x-icon" rel="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="../sh_vim-dark.css">
<link rel="stylesheet" href="../pipe.css">
<link rel="stylesheet" href="../sh_vim-dark.css">
<link rel="alternate"
type="application/rss+xml"
title="node blog"
href="http://feeds.feedburner.com/nodejs/123123123">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>node.js</title>
</head>
<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>.
</div>
<script type="text/javascript" src="../sh_main.js"></script>
<script type="text/javascript" src="../sh_javascript.min.js"></script>
<script type="text/javascript">highlight(undefined, undefined, 'pre');</script>
<script src="../sh_main.js"></script>
<script src="../sh_javascript.min.js"></script>
<script>highlight(undefined, undefined, 'pre');</script>
<script type="text/javascript">
<script>
var gaJsHost = (("https:" == document.location.protocol) ?
"https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
<script>
try {
var pageTracker = _gat._getTracker("UA-10874194-2");
pageTracker._trackPageview();

2
doc/api/addons.markdown

@ -88,4 +88,4 @@ the recently built module:
console.log(addon.hello()); // 'world'
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.

7
doc/api/crypto.markdown

@ -47,9 +47,10 @@ Example: this program that takes the sha1 sum of a file
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.
### 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);
} catch (ex) {
// handle error
}
}

17
doc/community/index.html

@ -1,15 +1,15 @@
<!doctype html>
<html>
<head>
<style type="text/css">
<meta charset="utf-8">
<style>
ul {
padding: 0;
margin: 0;
}
</style>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js?ver=3.1.3'></script>
<script type="text/javascript" src="../sh_main.js"></script>
<script type="text/javascript" src="../sh_javascript.min.js"></script>
<script src="../sh_main.js"></script>
<script src="../sh_javascript.min.js"></script>
<link type="image/x-icon" rel="icon" href="../favicon.ico">
<link type="image/x-icon" rel="shortcut icon" href="../favicon.ico">
<link type="text/css" rel="stylesheet" href="../pipe.css">
@ -18,7 +18,6 @@
type="application/rss+xml"
title="node blog"
href="http://feeds.feedburner.com/nodejs/123123123">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>node.js</title>
</head>
<body>
@ -148,16 +147,16 @@
is a <a href="trademark-policy.pdf">trademark of Joyent, Inc</a>.
</div>
<script type="text/javascript">
<script>
var gaJsHost = (("https:" == document.location.protocol) ?
"https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
<script>
try {
var pageTracker = _gat._getTracker("UA-10874194-2");
pageTracker._trackPageview();
} catch(err) {}
</script>
</body></html>
</body>
</html>

20
doc/index.html

@ -1,7 +1,8 @@
<!doctype html>
<html>
<html lang="en">
<head>
<style type="text/css">
<meta charset="utf-8">
<style>
ul {
padding: 0;
margin: 0;
@ -9,13 +10,12 @@
</style>
<link type="image/x-icon" rel="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="sh_vim-dark.css">
<link rel="stylesheet" href="pipe.css">
<link rel="stylesheet" href="sh_vim-dark.css">
<link rel="alternate"
type="application/rss+xml"
title="node blog"
href="http://feeds.feedburner.com/nodejs/123123123">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>node.js</title>
</head>
<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>.
</div>
<script type="text/javascript" src="sh_main.js"></script>
<script type="text/javascript" src="sh_javascript.min.js"></script>
<script type="text/javascript">highlight(undefined, undefined, 'pre');</script>
<script src="sh_main.js"></script>
<script src="sh_javascript.min.js"></script>
<script>highlight(undefined, undefined, 'pre');</script>
<script type="text/javascript">
<script>
var gaJsHost = (("https:" == document.location.protocol) ?
"https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
<script>
try {
var pageTracker = _gat._getTracker("UA-10874194-2");
pageTracker._trackPageview();

11
doc/template.html

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta charset="utf-8">
<title>{{section}}Node.js v0.6.6 Manual &amp; Documentation</title>
<link rel="stylesheet" href="assets/style.css">
<link rel="stylesheet" href="assets/sh.css">
@ -21,16 +21,15 @@
<script src="assets/sh_main.js"></script>
<script src="assets/sh_javascript.min.js"></script>
<script>highlight(undefined, undefined, 'pre');</script>
<script type="text/javascript">
<script>
var gaJsHost = (("https:" == document.location.protocol) ?
"https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
<script>
try {
var pageTracker = _gat._getTracker("UA-10874194-2");
pageTracker._trackPageview();
} catch(err) {}</script>
<script type="text/javascript">highlight(undefined, undefined, 'pre');</script>
</body>
</html>

4
lib/buffer.js

@ -698,7 +698,7 @@ Buffer.prototype.readInt8 = function(offset, noAssert) {
};
function readInt16(buffer, offset, isBigEndian, noAssert) {
var neg;
var neg, val;
if (!noAssert) {
assert.ok(typeof (isBigEndian) === 'boolean',
@ -729,7 +729,7 @@ Buffer.prototype.readInt16BE = function(offset, noAssert) {
};
function readInt32(buffer, offset, isBigEndian, noAssert) {
var neg;
var neg, val;
if (!noAssert) {
assert.ok(typeof (isBigEndian) === 'boolean',

2
lib/net.js

@ -443,6 +443,8 @@ Socket.prototype.write = function(data, arg1, arg2) {
Socket.prototype._write = function(data, encoding, cb) {
timers.active(this);
if (!this._handle) throw new Error('This socket is closed.');
// `encoding` is unused right now, `data` is always a buffer.
var writeReq = this._handle.write(data);

13
lib/timers.js

@ -108,8 +108,8 @@ var unenroll = exports.unenroll = function(item) {
list.close();
delete lists[item._idleTimeout];
}
//if active is called later, then we want to make sure not to insert again
delete item._idleTimeout;
// if active is called later, then we want to make sure not to insert again
item._idleTimeout = -1;
};
@ -151,17 +151,18 @@ exports.setTimeout = function(callback, after) {
if (after <= 0) {
// Use the slow case for after == 0
timer = new Timer();
timer._callback = callback;
if (arguments.length <= 2) {
timer._onTimeout = function() {
callback();
timer.close();
this._callback();
this.close();
}
} else {
var args = Array.prototype.slice.call(arguments, 2);
timer._onTimeout = function() {
callback.apply(timer, args);
timer.close();
this._callback.apply(timer, args);
this.close();
}
}

49
test/simple/test-net-write-after-close.js

@ -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…
Cancel
Save