Граф коммитов

8827 Коммитов

Автор SHA1 Сообщение Дата
Ben Noordhuis 2b569deed3 cluster: remove duplicate this.errno assignment 2013-07-28 11:36:13 +02:00
Maciej Małecki d713db245b doc: document possible return values of os.arch() 2013-07-26 17:55:55 -07:00
Dav Glass 7d654be627 doc: Fix missing backtick in debugger doc 2013-07-25 16:17:41 -07:00
isaacs 993bb93e0a streams: Don't emit 'end' until read() past EOF
This prevents the following sort of thing from being confusing:

```javascript
stream.on('data', function() { console.error('got data'); });
stream.pause(); // stop reading

// turns out no data is available
stream.push(null);

// Hand the stream to someone else, who does stuff...
setTimeout(function() {
  // too late! 'end' is already emitted!
  stream.on('end', function() { console.error('got end'); });
});
```

With this change, the `end` event is not emitted until you call `read()`
*past* the EOF null.  So, a paused stream will not swallow the `end`
event and emit it before you `resume()` the stream.
2013-07-25 13:14:49 -07:00
Fedor Indutny 508a6c2eee openssl: use asm for sha, md5, rmd 2013-07-25 18:27:26 +04:00
Fedor Indutny d62c2d975a tls: share tls tickets key between cluster workers
fix #5871
2013-07-25 01:16:00 +04:00
Fedor Indutny 509cfbc2b7 cluster: support setting data on shared server
If `obj` given to `cluster._getServer` has `_setServerData` or
`_getServerData` methods, the data will be synchronized across workers
and stored in master.
2013-07-25 01:15:59 +04:00
Ben Noordhuis 44ed42bd97 src: move NODE_MODULE_VERSION to node_version.h 2013-07-24 22:17:35 +02:00
Ben Noordhuis 0330bdf519 lib: macro-ify type checks
Increases the grep factor. Makes it easier to harmonize type checks
across the code base.
2013-07-24 21:49:35 +02:00
Ben Noordhuis 457d529241 tools: fix js2c macro expansion bug
If the same macro was used twice in close proximity, the second one
didn't get expanded.
2013-07-24 21:49:34 +02:00
Ben Noordhuis 4b279f0092 src: rename macros.py to notrace_macros.py
This incarnation of macros.py is only used to disable the (d)trace
macros. Rename it so it better reflects its purpose. A new macros.py
will be added in a follow-up commit.
2013-07-24 21:49:18 +02:00
Ben Noordhuis d8240769c6 src: cares_wrap: remove two unused variables 2013-07-24 18:49:47 +02:00
Trevor Norris c76ed64348 smalloc: add external to alloc with callbacks
Forgot to actually assign cb_info to the External in smalloc::Alloc()
that accepts a callback to be run in the weak callback.
2013-07-24 09:17:10 -07:00
Trevor Norris 8ce02cf0aa buffer: misc logic simplification
Includes:
* No need for `typeof` when checking undefined.
* length is coerced to uint so no need to check if < 0.
* Stay consistent and always throw `new` errors.
* Returning offset + magic number in every write is error prone. Instead
  return the central write function which returns the correct offset.
2013-07-23 11:02:47 -07:00
Trevor Norris d74932e518 buffer: revert length and parent check
In a rush to implement the fix 35e0d60 I overlooked the logic that
causes 0-length buffer instantiation to automatically not assign the
parent regardless.
2013-07-23 10:43:48 -07:00
David Björklund d904c231b6 crypto: Add test for sha.write(''); sha.end() 2013-07-22 18:43:06 -07:00
Trevor Norris 35e0d60d0c buffer: slice on zero length buffer
SlowBuffer(0) passes NULL instead of doing malloc(0). So when someone
attempted to SlowBuffer(0).slice(0, 1) an assert would fail in
smalloc::SliceOnto.

It's important that the check go where it is because the resulting
Buffer needs to have external array data allocated. In the case a user
tries to slice a zero length Buffer it will also have NULL passed as the
data argument.

Also fixed where the .parent attribute was set for zero length Buffers.
There is no need to track the source of slice if the slice isn't
actually occurring.
2013-07-22 17:27:59 -07:00
isaacs 0f8de5e1f9 stream: Simplify flowing, passive data listening
Closes #5860

In streams2, there is an "old mode" for compatibility.  Once switched
into this mode, there is no going back.

With this change, there is a "flowing mode" and a "paused mode".  If you
add a data listener, then this will start the flow of data.  However,
hitting the `pause()` method will switch *back* into a non-flowing mode,
where the `read()` method will pull data out.

Every time `read()` returns a data chunk, it also emits a `data` event.
In this way, a passive data listener can be added, and the stream passed
off to some other reader, for use with progress bars and the like.

There is no API change beyond this added flexibility.
2013-07-22 16:17:30 -07:00
Wyatt Preul 5fcd6e4038 util: removed duplicated isArray check 2013-07-22 16:07:40 -07:00
Ben Noordhuis e3bb6e11c3 v8: reapply floating patches 2013-07-22 15:56:44 -07:00
Trevor Norris dfb1191f22 src: update v8 build requirements
In v8 3.20.4 build/common.gypi was moved to build/toolchain.gypi and
build/features.gypi.
2013-07-22 15:53:43 -07:00
Trevor Norris 5777d7ab30 v8: upgrade to v8 3.20.7 2013-07-22 15:53:10 -07:00
Ben Noordhuis 254b711155 src: fix windows build error from 221c689e
Just forward declare struct sockaddr, the struct is never actually
dereferenced in src/node_internals.h.

Before this commit, it included sys/socket.h but that header doesn't
exist on Windows.
2013-07-20 21:45:24 +02:00
Ben Noordhuis d75f67f949 bench: fix up benchmarks after internal api change 2013-07-20 12:13:54 +02:00
Ben Noordhuis e1fe8d4ec0 test: fix up tests after internal api change 2013-07-20 12:13:54 +02:00
Ben Noordhuis ca9eb718fb src, lib: update after internal api change
Libuv now returns errors directly.  Make everything in src/ and lib/
follow suit.

The changes to lib/ are not strictly necessary but they remove the need
for the abominations that are process._errno and node::SetErrno().
2013-07-20 12:09:29 +02:00
Ben Noordhuis 0161ec87af src, lib: deduplicate errnoException 2013-07-20 12:04:35 +02:00
Ben Noordhuis d4c14c1fe5 src: add libuv bindings module
Exports:

* all UV_E* error codes
* a uv_err_name() binding
2013-07-20 12:04:35 +02:00
Ben Noordhuis 0e48cb4998 deps: upgrade libuv to 3ee4d3f 2013-07-20 12:04:35 +02:00
Ben Noordhuis 221c689ebb udp_wrap, tcp_wrap: add out arg to AddressToJS
Prep work for removing process._errno. The handle.getsockname() function
will return a status code in the future and set the address and port
properties on the object that's passed in from JS land.
2013-07-19 23:41:35 +02:00
Ben Noordhuis d11e7c2075 src: ReqWrap now optionally accepts a wrap object 2013-07-19 23:41:35 +02:00
Trevor Norris 4a34c69cbf buffer: return offset for end of last write 2013-07-19 14:05:46 -07:00
Ben Noordhuis 2bedf6efb1 src: fix persistent handle lifecycle issue
Commit 636ca7c adds an optimization that casts strong Persistent<T>
handles directly to Local<T> handles to avoid the overhead of creating
new HandleScope-rooted Local<T> handles all the time.

One gotcha that I missed is that it's no longer legal to reference the
Local<T> after calling Persistent<T>::Dispose(). This commit addresses
that.
2013-07-19 22:56:28 +02:00
Ben Noordhuis db13983e68 src: add IsFunction() assert to MakeCallback
Helps catch bugs early on. Without it, V8 throws the fairly
unhelpful exception "TypeError: undefined is not a function" -
unhelpful because there is no stack trace.
2013-07-19 22:56:28 +02:00
Ben Noordhuis 2b7d86ec73 tools: make check-imports.sh work on bsd-likes 2013-07-19 22:56:28 +02:00
Trevor Norris d817843d2e smalloc: create separate module
It will be confusing if later on we add Buffer#dispose(), and smalloc is
its own cpp api anyways. So instead create a new require('smalloc') to
expose the previous Buffer.alloc/dispose methods, and expose copyOnto
and kMaxLength as well.

Other changes:
* Added documentation and additional tests.
* smalloc::CopyOnto has changed from using assert() to throwing errors
  on bad argument values because it is not exposed to the user.
* Minor style fixes.
2013-07-19 13:36:13 -07:00
Trevor Norris 46d11510ad node: always set function name
For easier debugging it's helpful to always have the function name.
These were not set for methods coming from cc.
2013-07-19 12:47:06 -07:00
isaacs e71d9fd834 Merge remote-tracking branch 'ry/v0.10'
Conflicts:
	doc/api/stream.markdown
	lib/tls.js
2013-07-17 18:32:23 -07:00
Shuan Wang 48a4600c56 url: Fix edge-case when protocol is non-lowercase
When using url.parse(), path and pathname usually return '/' when there
is no path available. However when you have a protocol that contains
non-lowercase letters and the input string does not have a trailing
slash, both path and pathname will be undefined.
2013-07-17 15:59:28 -07:00
isaacs bd5ab9c601 doc: Explain process.nextTick timing
Provide more detailed explanation of the timing of `process.nextTick`
relative to I/O.
2013-07-16 13:02:54 -07:00
isaacs 04e0324f6a doc: style the 'type' fields in API docs 2013-07-16 10:49:54 -07:00
isaacs db5776cf8b doc: Streams API Doc Rewrite
The Streams API doc is now broken up into 3 sections:

1. API for Consumers
2. API for Implementors
3. Details and Extras

This addresses one of the biggest points of confusion for new users who
start to consume streams, and get the impression that they have to do
lots of extra work and implement classes and such, just to get some data
out of a file.
2013-07-16 10:49:54 -07:00
Trevor Norris be940b4501 smalloc: remove NULL assert check
In fa10b75 the assert to check if data == NULL was remove for
smalloc::Alloc with no callback. It should have also been removed where
a callback is accepted.

No sense in making sure that length == 0 if data == NULL because devs
already have to be responsible for checking that length is the same as
the char* they're passing in.
2013-07-15 11:08:23 -07:00
isaacs e48536f4cd tls: Trivial use_strict fix 2013-07-14 20:08:07 -07:00
Ben Noordhuis 2c47030174 src: remove Buffer::Data(Persistent<T>&)
It hits a compiler bug in gcc <= 4.4 similar to the issue that was
recently addressed in commit 157d2bc:

    ../deps/v8/include/v8.h: In function ‘char*
    node::Buffer::Data(v8::Persistent&) [with TypeName = v8::Object]’:
    ../src/node_crypto.cc:1123: instantiated from here
    ../deps/v8/include/v8.h:876: error: ‘class v8::Data’ is not a
    function,
    ../src/node_internals.h:356: error: conflict with ‘template char*
    node::Buffer::Data(v8::Persistent&)’
    ../src/node_internals.h:357: error: in call to ‘Data’

Remove the helper function, it was only used in a couple of places.
Should fix the build on Ubuntu 10.04.

Fixes #5844.
2013-07-13 14:08:23 +02:00
Timothy J Fontaine 875dd37a93 blog: v0.11.4 is unstable not stable 2013-07-12 17:05:53 -07:00
Timothy J Fontaine c898704db1 lint: fix _http_client.js after v0.10 merge 2013-07-12 15:18:53 -07:00
Timothy J Fontaine 81c2a36439 Now working on 0.11.5 2013-07-12 15:17:16 -07:00
Timothy J Fontaine 31109808ea Merge branch 'v0.11.4-release' 2013-07-12 15:16:33 -07:00
Timothy J Fontaine 21dd5f4ea9 blog: v0.11.4 release 2013-07-12 15:12:49 -07:00