platform/upstream/nodejs.git
13 years agoAbstract out net.Server.prototype._rejectPending
Ryan Dahl [Thu, 28 Oct 2010 18:33:33 +0000 (11:33 -0700)]
Abstract out net.Server.prototype._rejectPending

Does the same timeout action for maxConnections as it does for EMFILE.

13 years agoModule-level EMFILE handling
Jonas Pfenniger [Thu, 28 Oct 2010 10:02:44 +0000 (12:02 +0200)]
Module-level EMFILE handling

All net servers now share the same dummy socket. The ulimit warning is
throttled for all servers.

13 years agoBuild system improvements: (cross compilation, libnode, etc)
Rasmus Andersson [Mon, 25 Oct 2010 22:44:48 +0000 (00:44 +0200)]
Build system improvements: (cross compilation, libnode, etc)

- utilizing autoconf configure.guess to output canonical $target_{cpu,vendor,os}
- normalizing $target_cpu --> $arch according to v8 naming scheme
- normalizing $target_os --> $platform according to v8 naming scheme
- renamed c-ares platform-arch directories to represent v8 canonical names
- new targets in Makefile: libnode-{static,dynamic}[-debug]
- scons is symbolized as SCONS in Makefile for portability/flexibility.
- LINKFLAGS inherith from LDFLAGS ("magic" variable exported by autoconf and configure).
- When building on OS X, CFLAGS and LDFLAGS will contain appropriate -arch flag, set up by configure (instead of the Makefile).
- libv8.a make targets cleaned up with unison libv8_flags set of flags.
- the clean make target now cleans up libraries (libv8, libnode, etc).
- added config.guess, config.sub and install-sh (utilized by autoconf/configure)

13 years agoHandle cyclic links smarter in fs.realpath
isaacs [Mon, 25 Oct 2010 19:28:53 +0000 (12:28 -0700)]
Handle cyclic links smarter in fs.realpath

Rather than aborting in the face of *any* repeated link in a given path,
instead only abort if such a cycle actually makes a given path unresolvable.

Test for this by doing a normal stat.  Still use the seenLinks object to
cache link contents so as to cut own a little bit on readlink calls.

Also add a pathological test that fails without the change to fs.js.

13 years agoLet exit listeners know the exit code
isaacs [Sat, 23 Oct 2010 23:44:19 +0000 (16:44 -0700)]
Let exit listeners know the exit code

13 years agomake "node --eval" eval in the global scope.
Jorge Chamorro Bieling [Sat, 23 Oct 2010 20:39:25 +0000 (22:39 +0200)]
make "node --eval" eval in the global scope.

13 years agoRefactor callbacks in net.Stream for fewer closures
Ryan Dahl [Wed, 27 Oct 2010 22:29:08 +0000 (15:29 -0700)]
Refactor callbacks in net.Stream for fewer closures

13 years agoAdd extra anti-DoS tech to net.Server
Ryan Dahl [Wed, 27 Oct 2010 19:08:47 +0000 (12:08 -0700)]
Add extra anti-DoS tech to net.Server

13 years agoImprove idle benchmarks
Ryan Dahl [Wed, 27 Oct 2010 09:52:49 +0000 (02:52 -0700)]
Improve idle benchmarks

13 years agoGracefully handle EMFILE
Ryan Dahl [Wed, 27 Oct 2010 09:10:14 +0000 (02:10 -0700)]
Gracefully handle EMFILE

Implementing a tip from Marc Lehmann:
http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#The_special_problem_of_accept_ing_wh

Keep an extra FD around for every server. When you hit EMFILE, destroy that
FD, accept a connection, close it; in this way you can clear the connection
queue and let people know that you're overload.

No more timeout needed.

13 years agoStyle changes.
Tim-Smart [Tue, 26 Oct 2010 04:05:04 +0000 (17:05 +1300)]
Style changes.

13 years agoUse the timer list for setTimeout
Ryan Dahl [Tue, 26 Oct 2010 19:52:31 +0000 (12:52 -0700)]
Use the timer list for setTimeout

13 years agoMove setTimeout and friends into timers module
Ryan Dahl [Tue, 26 Oct 2010 19:14:17 +0000 (12:14 -0700)]
Move setTimeout and friends into timers module

13 years agoMove idle timers into its own module
Ryan Dahl [Tue, 26 Oct 2010 18:56:32 +0000 (11:56 -0700)]
Move idle timers into its own module

13 years agoAdd C++ API for constructing fast buffer from string
Ryan Dahl [Tue, 26 Oct 2010 20:43:58 +0000 (13:43 -0700)]
Add C++ API for constructing fast buffer from string

13 years agoRemove old TODOs
Ryan Dahl [Tue, 26 Oct 2010 18:31:32 +0000 (11:31 -0700)]
Remove old TODOs

13 years agoFix permissions on http.js
Ryan Dahl [Tue, 26 Oct 2010 18:31:01 +0000 (11:31 -0700)]
Fix permissions on http.js

13 years agoRemove old todo
Ryan Dahl [Tue, 26 Oct 2010 08:10:32 +0000 (01:10 -0700)]
Remove old todo

13 years agoallowHalfOpen disabled by default
Ryan Dahl [Tue, 26 Oct 2010 05:04:39 +0000 (22:04 -0700)]
allowHalfOpen disabled by default

Users too often would forget to add

  socket.on('end', function () {
    socket.end();
  });

Which is a mistake. Therefore we default to this behavior and
only optionally let people handle the 'end' case themselves.

13 years agocreate directories during configure
Ryan Dahl [Tue, 26 Oct 2010 02:52:58 +0000 (19:52 -0700)]
create directories during configure

13 years agoexec instead of sh a the configure.real script
Ryan Dahl [Tue, 26 Oct 2010 02:25:49 +0000 (19:25 -0700)]
exec instead of sh a the configure.real script

13 years agomore configure hackery
Ryan Dahl [Tue, 26 Oct 2010 01:33:15 +0000 (18:33 -0700)]
more configure hackery

13 years agoIgnore configure.real
Ryan Dahl [Tue, 26 Oct 2010 01:24:48 +0000 (18:24 -0700)]
Ignore configure.real

13 years agoadd configure
Ryan Dahl [Tue, 26 Oct 2010 01:17:19 +0000 (18:17 -0700)]
add configure

13 years agofix style
Ryan Dahl [Tue, 26 Oct 2010 00:30:08 +0000 (17:30 -0700)]
fix style

13 years agoSet the readable variables on the read/write streams
Paul Querna [Mon, 25 Oct 2010 22:41:58 +0000 (15:41 -0700)]
Set the readable variables on the read/write streams

and add more debug() calls to make it easier to see the flow

13 years agoAdd SecurePair for handling of a ssl/tls stream.
Paul Querna [Mon, 25 Oct 2010 21:50:34 +0000 (14:50 -0700)]
Add SecurePair for handling of a ssl/tls stream.

13 years agoremove old todo.
Paul Querna [Mon, 25 Oct 2010 16:03:19 +0000 (09:03 -0700)]
remove old todo.

13 years agoCentralize error handling in SecureStream
Paul Querna [Thu, 21 Oct 2010 06:40:15 +0000 (23:40 -0700)]
Centralize error handling in SecureStream

and add a start method, to kick off SSL handshaking, without writing a zero
byte buffer

13 years agoAdd make install
isaacs [Mon, 25 Oct 2010 18:22:36 +0000 (11:22 -0700)]
Add make install

13 years agoUpdate node_net.cc to make us of node_constants.cc
Micheil Smith [Sat, 23 Oct 2010 01:28:26 +0000 (12:28 +1100)]
Update node_net.cc to make us of node_constants.cc

also affects dgram which uses a constant from node_net.cc

13 years agoAdd HAVE_OPENSSL flag to makefile
Paul Querna [Mon, 25 Oct 2010 17:27:39 +0000 (10:27 -0700)]
Add HAVE_OPENSSL flag to makefile

13 years agoadd todo about half-open connections
Ryan Dahl [Mon, 25 Oct 2010 03:11:47 +0000 (20:11 -0700)]
add todo about half-open connections

13 years agoRemove test-base64-bigfile
Ryan Dahl [Mon, 25 Oct 2010 02:20:36 +0000 (19:20 -0700)]
Remove test-base64-bigfile

Already tested in test/simple/test-buffer.js. Takes too long, uses too much
memory.

13 years agoReplace WAF with make/autoconf
Ryan Dahl [Mon, 4 Oct 2010 09:11:27 +0000 (02:11 -0700)]
Replace WAF with make/autoconf

13 years agoNow working on v0.3.1
Ryan Dahl [Sat, 23 Oct 2010 23:01:37 +0000 (16:01 -0700)]
Now working on v0.3.1

13 years agobump version to 0.3.0 v0.3.0
Ryan Dahl [Sat, 23 Oct 2010 22:46:58 +0000 (15:46 -0700)]
bump version to 0.3.0

13 years agoRevert "Add some failing tests for path.join"
Ryan Dahl [Sat, 23 Oct 2010 22:35:58 +0000 (15:35 -0700)]
Revert "Add some failing tests for path.join"

This reverts commit 8c0e87f9c333f3519b6d6439099f669a316ed598.

(Revert until fix comes)

13 years agoone more 'listening' race condition
Ryan Dahl [Sat, 23 Oct 2010 21:26:31 +0000 (14:26 -0700)]
one more 'listening' race condition

13 years agoFix a few 'listening' race conditions
Ryan Dahl [Sat, 23 Oct 2010 21:11:30 +0000 (14:11 -0700)]
Fix a few 'listening' race conditions

in
test-net-timeout
test-http-client-parse-error

13 years agoDo not spin on aceept() with EMFILE
Ryan Dahl [Sat, 23 Oct 2010 18:59:32 +0000 (11:59 -0700)]
Do not spin on aceept() with EMFILE

When a server hit EMFILE it would continue to try to accept new connections
from the queue. This patch introduces a timeout of one second where it will
stop trying to accept new files. After the second is over it tries again.

This is a rather serious bug that has been effecting many highly concurrent
programs. It was introduced in 4593c0, version v0.2.0.

TODO: A test for this situation. Currently I test it like this

  termA% cd projects/node
  termA% ulimit -n 256
  termA% ./node benchmark/idle_server.js

  termB% cd projects/node
  termB% ./node benchmark/idle_clients.js

And watch how the server process behaves.

13 years agoMake sure Error object on exec() gets killed member
Ryan Dahl [Sat, 23 Oct 2010 18:36:30 +0000 (11:36 -0700)]
Make sure Error object on exec() gets killed member

Also default to SIGTERM for destruction when exceeding timeout or buffer on
exec()

13 years agoFix test-net-eaddrinuse
Ryan Dahl [Sat, 23 Oct 2010 18:22:24 +0000 (11:22 -0700)]
Fix test-net-eaddrinuse

13 years agoProvide a C++ Buffer constructor for external storage.
Stéphan Kochen [Fri, 22 Oct 2010 10:08:55 +0000 (12:08 +0200)]
Provide a C++ Buffer constructor for external storage.

In order to do this, buffer data management was moved out of the
JS entry-point New, and into Replace.

Secondly, the constructor makes an immediate call to Replace, and
in order for ArrayData calls to work, wrapping must already be set
up. Now, the constructor takes the wrappee as a parameter.

13 years agoGeneralize Buffer::Copy to work with all unsigned byte external data.
Stéphan Kochen [Thu, 21 Oct 2010 09:53:02 +0000 (11:53 +0200)]
Generalize Buffer::Copy to work with all unsigned byte external data.

13 years agoSimplify things by using `*ArrayData` everywhere.
Stéphan Kochen [Thu, 21 Oct 2010 09:47:27 +0000 (11:47 +0200)]
Simplify things by using `*ArrayData` everywhere.

13 years agoRemove old interface remains from Buffer.
Stéphan Kochen [Thu, 21 Oct 2010 09:37:08 +0000 (11:37 +0200)]
Remove old interface remains from Buffer.

These were all lacking implementation, so deprecating wouldn't help.

13 years agoDon't call AtExit twice
Ryan Dahl [Fri, 22 Oct 2010 17:17:38 +0000 (10:17 -0700)]
Don't call AtExit twice

13 years agoFix parsing of linux memory
Vitali Lovich [Fri, 16 Jul 2010 08:07:43 +0000 (01:07 -0700)]
Fix parsing of linux memory

If process name contains a space, this parsing fails for no good reason.

13 years agoWrite write.txt into the tmpdir
Ryan Dahl [Fri, 22 Oct 2010 17:02:30 +0000 (10:02 -0700)]
Write write.txt into the tmpdir

13 years agoRemove a confusing sentence in the docs
Ryan Dahl [Fri, 22 Oct 2010 00:31:38 +0000 (17:31 -0700)]
Remove a confusing sentence in the docs

13 years agoRemove unneeded function wrappers
Jorge Chamorro Bieling [Thu, 21 Oct 2010 12:36:00 +0000 (14:36 +0200)]
Remove unneeded function wrappers

13 years agoUpgrade libev to 4.00
Ryan Dahl [Thu, 21 Oct 2010 22:38:32 +0000 (15:38 -0700)]
Upgrade libev to 4.00

13 years agoUpgrade V8 to 2.5.1
Ryan Dahl [Thu, 21 Oct 2010 22:22:38 +0000 (15:22 -0700)]
Upgrade V8 to 2.5.1

13 years agoAdd isatty for isaacs
Ryan Dahl [Thu, 21 Oct 2010 19:34:37 +0000 (12:34 -0700)]
Add isatty for isaacs

13 years agoForce exit on SIGINT but still reset flags on stdio fds
Ryan Dahl [Thu, 21 Oct 2010 19:27:58 +0000 (12:27 -0700)]
Force exit on SIGINT but still reset flags on stdio fds

Add test that one can ctrl+c out of a script spinning infinitely.

13 years agoAdd incomplete R plot file
Ryan Dahl [Thu, 21 Oct 2010 04:01:43 +0000 (21:01 -0700)]
Add incomplete R plot file

13 years agoFix execFile timeouts, improve tests
Ryan Dahl [Thu, 21 Oct 2010 02:20:44 +0000 (19:20 -0700)]
Fix execFile timeouts, improve tests

It seems that a parent will not get a SIGCHLD if the child is killed by the
parent? It's unclear, so make 'exit' callback manually.

13 years agoChildProcesses cannot be killed if pid is missing
Ryan Dahl [Thu, 21 Oct 2010 00:55:25 +0000 (17:55 -0700)]
ChildProcesses cannot be killed if pid is missing

13 years agoAdd --max-stack-size flag.
Tom Hughes [Mon, 18 Oct 2010 22:50:56 +0000 (17:50 -0500)]
Add --max-stack-size flag.

v8 doesn't expose a command-line flag to set the stack size, so this
adds a new flag that node understands how to handle and uses v8's
ResourceConstraints API.

13 years agoAdd ~/.node_modules as well as ~/.node_libraries
isaacs [Tue, 19 Oct 2010 20:28:13 +0000 (13:28 -0700)]
Add ~/.node_modules as well as ~/.node_libraries

13 years agorequire looks in node_modules folders
isaacs [Thu, 14 Oct 2010 00:15:56 +0000 (17:15 -0700)]
require looks in  node_modules folders

for modules starting with the __dirname and moving up.

This makes it much easier to localize dependencies to a particular program.

13 years agoThe cwdRequire hack is no longer necessary with the require.resolve refactor.
isaacs [Tue, 19 Oct 2010 19:01:22 +0000 (12:01 -0700)]
The cwdRequire hack is no longer necessary with the require.resolve refactor.

13 years agoSplit out modulePaths and defaultPaths
isaacs [Tue, 19 Oct 2010 18:36:10 +0000 (11:36 -0700)]
Split out modulePaths and defaultPaths

This way, the "default" paths of ~/.node_libraries and {prefix}/lib/node are only checked *after* anything that the user has placed into the NODE_PATHS environ, or pushed onto require.paths.

This makes require.paths a much more effective write-target, albeit slightly less useful as a read-target.  However, given the existence of require.resolve(), this is less of an issue -- if you want to know what a module ID will map to, just ask that question and get an authoritative answer from the loading machinery.

13 years agoDocs for require.resolve
isaacs [Wed, 20 Oct 2010 20:56:22 +0000 (13:56 -0700)]
Docs for require.resolve

13 years agoAdd some failing tests for path.join
Ryan Dahl [Wed, 20 Oct 2010 20:03:39 +0000 (13:03 -0700)]
Add some failing tests for path.join

13 years agoPrevents child_process.exec timeouts from throwing when the child was previously...
Aaron Heckmann [Tue, 19 Oct 2010 12:42:00 +0000 (08:42 -0400)]
Prevents child_process.exec timeouts from throwing when the child was previously killed.

13 years agoAdd require.resolve.
isaacs [Tue, 19 Oct 2010 01:17:33 +0000 (18:17 -0700)]
Add require.resolve.

Also, hack the repl so that it works as expected there, too.

13 years agoRemove old references to old 'stream' event
Ryan Dahl [Wed, 20 Oct 2010 18:10:40 +0000 (11:10 -0700)]
Remove old references to old 'stream' event

13 years agoAdded documentation of EventEmitter.once
Nikhil Marathe [Tue, 19 Oct 2010 03:36:26 +0000 (09:06 +0530)]
Added documentation of EventEmitter.once

13 years agouse bash instead of sh in http_simple_bench.sh
Ryan Dahl [Tue, 19 Oct 2010 00:48:49 +0000 (17:48 -0700)]
use bash instead of sh in http_simple_bench.sh

13 years agoUpgrade V8 to 2.5.0
Ryan Dahl [Tue, 19 Oct 2010 00:13:30 +0000 (17:13 -0700)]
Upgrade V8 to 2.5.0

13 years agonet listen should emit eaddrinuse error
Johan Euphrosine [Wed, 6 Oct 2010 17:18:08 +0000 (19:18 +0200)]
net listen should emit eaddrinuse error

13 years agoFix expect/continue keepalive
Mark Nottingham [Mon, 18 Oct 2010 05:14:29 +0000 (16:14 +1100)]
Fix expect/continue keepalive

13 years agounbase64 skips over *any* illegal chars
Jorge Chamorro Bieling [Mon, 18 Oct 2010 20:08:42 +0000 (22:08 +0200)]
unbase64 skips over *any* illegal chars

13 years agoFix race conditions in test-http-upgrade-client2
Ryan Dahl [Mon, 18 Oct 2010 22:05:18 +0000 (15:05 -0700)]
Fix race conditions in test-http-upgrade-client2

13 years agofix test-base64-bigfile for linux
Ryan Dahl [Mon, 18 Oct 2010 22:00:49 +0000 (15:00 -0700)]
fix test-base64-bigfile for linux

13 years agoFix test harness for Linux
Ryan Dahl [Mon, 18 Oct 2010 21:46:25 +0000 (14:46 -0700)]
Fix test harness for Linux

Mostly just upgraded tools/test.py to the latest one that's in V8.  But also
fixing the before and after hooks to preserve the test/tmp directory so that
running tests manually usually works.

13 years agonew api for defining repl commands
Sami Samhuri [Wed, 13 Oct 2010 14:51:53 +0000 (07:51 -0700)]
new api for defining repl commands

13 years ago./wscript: allow for cross-compiling of all three supported architectures
AJ ONeal [Wed, 13 Oct 2010 22:27:51 +0000 (16:27 -0600)]
./wscript: allow for cross-compiling of all three supported architectures

13 years agoA big base64 file encoding/decoding test
isaacs [Thu, 7 Oct 2010 23:25:30 +0000 (16:25 -0700)]
A big base64 file encoding/decoding test

Originally written to try to track down this bug report:
http://permalink.gmane.org/gmane.comp.lang.javascript.nodejs/13924

As it turns out, it's showing a completely different kind of failure.  When
the file is base64 encoded with the native program, then decoded with node,
it doesn't match the original.  Something's fishy.

13 years agobase64 decode should handle whitespace
Ryan Dahl [Mon, 18 Oct 2010 18:15:20 +0000 (11:15 -0700)]
base64 decode should handle whitespace

13 years agoInstall ev.h and eio.h
Ryan Dahl [Mon, 18 Oct 2010 05:57:40 +0000 (22:57 -0700)]
Install ev.h and eio.h

13 years agoAdd EventEmitter.prototype.once
Peteris Krumins [Tue, 12 Oct 2010 20:52:26 +0000 (23:52 +0300)]
Add EventEmitter.prototype.once

13 years agoAdd idle connection test
Ryan Dahl [Fri, 15 Oct 2010 17:05:22 +0000 (12:05 -0500)]
Add idle connection test

13 years agoAdd 'make bench' script
Ryan Dahl [Wed, 13 Oct 2010 23:20:24 +0000 (16:20 -0700)]
Add 'make bench' script

13 years agoImprove benchmark/http_simple.js
Ryan Dahl [Wed, 13 Oct 2010 21:16:49 +0000 (14:16 -0700)]
Improve benchmark/http_simple.js

13 years agoUpgrade http-parser with a fix for spaces in headers
Nathan Rajlich [Wed, 13 Oct 2010 09:45:37 +0000 (02:45 -0700)]
Upgrade http-parser with a fix for spaces in headers

13 years agoDon't flush net writeQueue on end() if its still connecting
Joshua Peek [Tue, 12 Oct 2010 04:19:44 +0000 (23:19 -0500)]
Don't flush net writeQueue on end() if its still connecting

13 years agoPreliminary pkg-config support.
Ben Noordhuis [Tue, 12 Oct 2010 21:13:44 +0000 (23:13 +0200)]
Preliminary pkg-config support.

13 years agoAllow people to set backlog. Need a better API.
Ryan Dahl [Wed, 13 Oct 2010 08:47:29 +0000 (01:47 -0700)]
Allow people to set backlog. Need a better API.

13 years agoAdd signal handlers so we clean up before exiting.
Tom Hughes [Tue, 12 Oct 2010 21:01:58 +0000 (14:01 -0700)]
Add signal handlers so we clean up before exiting.

Add SIGTERM and SIGINT signal handlers so that we run the exit handlers
before exiting when getting these signals. Fixes an issue where we
couldn't run vi after CTRL+C'ing node because the stdin fd was left
non-blocking.

13 years agoAdd .js to native script's filename
Ryan Dahl [Tue, 12 Oct 2010 18:54:45 +0000 (11:54 -0700)]
Add .js to native script's filename

13 years agoDynamically load native scripts
Ryan Dahl [Tue, 12 Oct 2010 18:49:41 +0000 (11:49 -0700)]
Dynamically load native scripts

13 years agoDon't require events in fs.js
Ryan Dahl [Mon, 11 Oct 2010 23:40:28 +0000 (16:40 -0700)]
Don't require events in fs.js

13 years agofs.ReadStream and fs.WriteStream derive from stream.Stream
Ryan Dahl [Mon, 11 Oct 2010 23:39:40 +0000 (16:39 -0700)]
fs.ReadStream and fs.WriteStream derive from stream.Stream

13 years agoAdd destroy methods to HTTP messages
Ryan Dahl [Mon, 11 Oct 2010 23:36:12 +0000 (16:36 -0700)]
Add destroy methods to HTTP messages

needs tests (particularly for pipeline situations)

13 years agoMigrated from sys.p to console.dir
Micheil Smith [Mon, 11 Oct 2010 23:09:02 +0000 (10:09 +1100)]
Migrated from sys.p to console.dir

13 years agoRemoved deprecated methods from lib/path.js
Micheil Smith [Mon, 11 Oct 2010 23:06:44 +0000 (10:06 +1100)]
Removed deprecated methods from lib/path.js

13 years agoRemoved deprecated methods from lib/net.js
Micheil Smith [Mon, 11 Oct 2010 23:04:18 +0000 (10:04 +1100)]
Removed deprecated methods from lib/net.js