Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Merge branch 'v0.9.2-release'
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Sep 18, 2012
2 parents 90a6253 + 6e20558 commit 7fcb7b4
Show file tree
Hide file tree
Showing 30 changed files with 1,278 additions and 286 deletions.
7 changes: 7 additions & 0 deletions AUTHORS
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -357,3 +357,10 @@ Gil Pedersen <git@gpost.dk>
Tyler Neylon <tylerneylon@gmail.com> Tyler Neylon <tylerneylon@gmail.com>
Golo Roden <webmaster@goloroden.de> Golo Roden <webmaster@goloroden.de>
Ron Korving <rkorving@wizcorp.jp> Ron Korving <rkorving@wizcorp.jp>
Brandon Wilson <chlavois@gmail.com>
Ian Babrou <ibobrik@gmail.com>
Bearice Ren <bearice@gmail.com>
Ankur Oberoi <aoberoi@gmail.com>
Atsuya Takagi <atsuya.takagi@gmail.com>
Pooya Karimian <pkarimian@sencha.com>
Frédéric Germain <frederic.germain@gmail.com>
45 changes: 44 additions & 1 deletion ChangeLog
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,47 @@
2012.08.28, Version 0.9.1 (Unstable) 2012.09.17, Version 0.9.2 (Unstable)

* http_parser: upgrade to ad3b631

* openssl: upgrade 1.0.1c

* darwin: use FSEvents to watch directory changes (Fedor Indutny)

* unix: support missing API on NetBSD (Shigeki Ohtsu)

* unix: fix EMFILE busy loop (Ben Noordhuis)

* windows: un-break writable tty handles (Bert Belder)

* windows: map WSAESHUTDOWN to UV_EPIPE (Bert Belder)

* windows: make spawn with custom environment work again (Bert Belder)

* windows: map ERROR_DIRECTORY to UV_ENOENT (Bert Belder)

* tls, https: validate server certificate by default (Ben Noordhuis)

* tls, https: throw exception on missing key/cert (Ben Noordhuis)

* tls: async session storage (Fedor Indutny)

* installer: don't install header files (Ben Noordhuis)

* buffer: implement Buffer.prototype.toJSON() (Nathan Rajlich)

* buffer: added support for writing NaN and Infinity (koichik)

* http: make http.ServerResponse emit 'end' (Ben Noordhuis)

* build: ./configure --ninja (Ben Noordhuis, Timothy J Fontaine)

* installer: fix --without-npm (Ben Noordhuis)

* cli: make -p equivalent to -pe (Ben Noordhuis)

* url: Go much faster by using Url class (isaacs)


2012.08.28, Version 0.9.1 (Unstable), e6ce259d2caf338fec991c2dd447de763ce99ab7


* buffer: Add Buffer.isEncoding(enc) to test for valid encoding values (isaacs) * buffer: Add Buffer.isEncoding(enc) to test for valid encoding values (isaacs)


Expand Down
4 changes: 2 additions & 2 deletions deps/openssl/openssl.gyp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
'OPENSSL_NO_SCTP', 'OPENSSL_NO_SCTP',
'OPENSSL_NO_SOCK', 'OPENSSL_NO_SOCK',
# Work around brain dead SunOS linker. # Work around brain dead SunOS linker.
'OPENSSL_NO_RDRAND',
'OPENSSL_NO_GOST', 'OPENSSL_NO_GOST',
'OPENSSL_NO_HW_PADLOCK', 'OPENSSL_NO_HW_PADLOCK',
'OPENSSL_NO_TTY', 'OPENSSL_NO_TTY',
Expand Down Expand Up @@ -353,7 +354,7 @@
'openssl/crypto/engine/eng_list.c', 'openssl/crypto/engine/eng_list.c',
'openssl/crypto/engine/eng_openssl.c', 'openssl/crypto/engine/eng_openssl.c',
'openssl/crypto/engine/eng_pkey.c', 'openssl/crypto/engine/eng_pkey.c',
'openssl/crypto/engine/eng_rdrand.c', #'openssl/crypto/engine/eng_rdrand.c',
'openssl/crypto/engine/eng_rsax.c', 'openssl/crypto/engine/eng_rsax.c',
'openssl/crypto/engine/eng_table.c', 'openssl/crypto/engine/eng_table.c',
'openssl/crypto/engine/tb_asnmth.c', 'openssl/crypto/engine/tb_asnmth.c',
Expand Down Expand Up @@ -557,7 +558,6 @@
'openssl/crypto/sha/sha_one.c', 'openssl/crypto/sha/sha_one.c',
'openssl/crypto/srp/srp_lib.c', 'openssl/crypto/srp/srp_lib.c',
'openssl/crypto/srp/srp_vfy.c', 'openssl/crypto/srp/srp_vfy.c',
'openssl/crypto/srp/srptest.c',
'openssl/crypto/stack/stack.c', 'openssl/crypto/stack/stack.c',
'openssl/crypto/store/str_err.c', 'openssl/crypto/store/str_err.c',
'openssl/crypto/store/str_lib.c', 'openssl/crypto/store/str_lib.c',
Expand Down
3 changes: 3 additions & 0 deletions deps/uv/include/uv-private/uv-darwin.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
ev_io event_watcher; \ ev_io event_watcher; \
int fflags; \ int fflags; \
int fd; \ int fd; \
char* realpath; \
int realpath_len; \
int cf_flags; \
void* cf_eventstream; \ void* cf_eventstream; \
uv_async_t* cf_cb; \ uv_async_t* cf_cb; \
ngx_queue_t cf_events; \ ngx_queue_t cf_events; \
Expand Down
3 changes: 1 addition & 2 deletions deps/uv/include/uv-private/uv-unix.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -185,8 +185,7 @@ typedef struct {
int fd; \ int fd; \
UV_STREAM_PRIVATE_PLATFORM_FIELDS \ UV_STREAM_PRIVATE_PLATFORM_FIELDS \


#define UV_TCP_PRIVATE_FIELDS \ #define UV_TCP_PRIVATE_FIELDS /* empty */
uv_idle_t* idle_handle; /* for UV_TCP_SINGLE_ACCEPT handles */ \


#define UV_UDP_PRIVATE_FIELDS \ #define UV_UDP_PRIVATE_FIELDS \
int fd; \ int fd; \
Expand Down
21 changes: 19 additions & 2 deletions deps/uv/include/uv.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -599,6 +599,11 @@ struct uv_tcp_s {


UV_EXTERN int uv_tcp_init(uv_loop_t*, uv_tcp_t* handle); UV_EXTERN int uv_tcp_init(uv_loop_t*, uv_tcp_t* handle);


/*
* Opens an existing file descriptor or SOCKET as a tcp handle.
*/
UV_EXTERN int uv_tcp_open(uv_tcp_t* handle, uv_os_sock_t sock);

/* Enable/disable Nagle's algorithm. */ /* Enable/disable Nagle's algorithm. */
UV_EXTERN int uv_tcp_nodelay(uv_tcp_t* handle, int enable); UV_EXTERN int uv_tcp_nodelay(uv_tcp_t* handle, int enable);


Expand Down Expand Up @@ -703,6 +708,11 @@ struct uv_udp_send_s {
*/ */
UV_EXTERN int uv_udp_init(uv_loop_t*, uv_udp_t* handle); UV_EXTERN int uv_udp_init(uv_loop_t*, uv_udp_t* handle);


/*
* Opens an existing file descriptor or SOCKET as a udp handle.
*/
UV_EXTERN int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock);

/* /*
* Bind to a IPv4 address and port. * Bind to a IPv4 address and port.
* *
Expand Down Expand Up @@ -940,7 +950,7 @@ UV_EXTERN int uv_pipe_init(uv_loop_t*, uv_pipe_t* handle, int ipc);
/* /*
* Opens an existing file descriptor or HANDLE as a pipe. * Opens an existing file descriptor or HANDLE as a pipe.
*/ */
UV_EXTERN void uv_pipe_open(uv_pipe_t*, uv_file file); UV_EXTERN int uv_pipe_open(uv_pipe_t*, uv_file file);


UV_EXTERN int uv_pipe_bind(uv_pipe_t* handle, const char* name); UV_EXTERN int uv_pipe_bind(uv_pipe_t* handle, const char* name);


Expand Down Expand Up @@ -1665,7 +1675,14 @@ enum uv_fs_event_flags {
* regular interval. * regular interval.
* This flag is currently not implemented yet on any backend. * This flag is currently not implemented yet on any backend.
*/ */
UV_FS_EVENT_STAT = 2 UV_FS_EVENT_STAT = 2,

/*
* By default, event watcher, when watching directory, is not registering
* (is ignoring) changes in it's subdirectories.
* This flag will override this behaviour on platforms that support it.
*/
UV_FS_EVENT_RECURSIVE = 3
}; };




Expand Down
56 changes: 52 additions & 4 deletions deps/uv/src/unix/fsevents.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -66,8 +66,13 @@ void uv__fsevents_cb(uv_async_t* cb, int status) {
handle = cb->data; handle = cb->data;


UV__FSEVENTS_WALK(handle, { UV__FSEVENTS_WALK(handle, {
if (handle->fd != -1) if (handle->fd != -1) {
#ifdef MAC_OS_X_VERSION_10_7
handle->cb(handle, event->path, event->events, 0); handle->cb(handle, event->path, event->events, 0);
#else
handle->cb(handle, NULL, event->events, 0);
#endif /* MAC_OS_X_VERSION_10_7 */
}
}) })


if ((handle->flags & (UV_CLOSING | UV_CLOSED)) == 0 && handle->fd == -1) if ((handle->flags & (UV_CLOSING | UV_CLOSED)) == 0 && handle->fd == -1)
Expand All @@ -84,6 +89,8 @@ void uv__fsevents_event_cb(ConstFSEventStreamRef streamRef,
size_t i; size_t i;
int len; int len;
char** paths; char** paths;
char* path;
char* pos;
uv_fs_event_t* handle; uv_fs_event_t* handle;
uv__fsevents_event_t* event; uv__fsevents_event_t* event;
ngx_queue_t add_list; ngx_queue_t add_list;
Expand All @@ -99,17 +106,50 @@ void uv__fsevents_event_cb(ConstFSEventStreamRef streamRef,
kFSEventStreamEventFlagEventIdsWrapped | kFSEventStreamEventFlagEventIdsWrapped |
kFSEventStreamEventFlagHistoryDone | kFSEventStreamEventFlagHistoryDone |
kFSEventStreamEventFlagMount | kFSEventStreamEventFlagMount |
kFSEventStreamEventFlagUnmount)) { kFSEventStreamEventFlagUnmount |
kFSEventStreamEventFlagRootChanged)) {
continue; continue;
} }


/* TODO: Report errors */ /* TODO: Report errors */
len = strlen(paths[i]); path = paths[i];
len = strlen(path);

/* Remove absolute path prefix */
if (strstr(path, handle->realpath) == path) {
path += handle->realpath_len;
len -= handle->realpath_len;

/* Skip back slash */
if (*path != 0) {
path++;
len--;
}
}

#ifdef MAC_OS_X_VERSION_10_7
/* Ignore events with path equal to directory itself */
if (len == 0)
continue;
#endif /* MAC_OS_X_VERSION_10_7 */

/* Do not emit events from subdirectories (without option set) */
pos = strchr(path, '/');
if ((handle->cf_flags & UV_FS_EVENT_RECURSIVE) == 0 &&
pos != NULL &&
pos != path + 1)
continue;

#ifndef MAC_OS_X_VERSION_10_7
path = "";
len = 0;
#endif /* MAC_OS_X_VERSION_10_7 */

event = malloc(sizeof(*event) + len); event = malloc(sizeof(*event) + len);
if (event == NULL) if (event == NULL)
break; break;


memcpy(event->path, paths[i], len + 1); memcpy(event->path, path, len + 1);


if (eventFlags[i] & kFSEventStreamEventFlagItemModified) if (eventFlags[i] & kFSEventStreamEventFlagItemModified)
event->events = UV_CHANGE; event->events = UV_CHANGE;
Expand Down Expand Up @@ -153,6 +193,11 @@ int uv__fsevents_init(uv_fs_event_t* handle) {
ctx.release = NULL; ctx.release = NULL;
ctx.copyDescription = NULL; ctx.copyDescription = NULL;


/* Get absolute path to file */
handle->realpath = realpath(handle->filename, NULL);
if (handle->realpath != NULL)
handle->realpath_len = strlen(handle->realpath);

/* Initialize paths array */ /* Initialize paths array */
path = CFStringCreateWithCString(NULL, path = CFStringCreateWithCString(NULL,
handle->filename, handle->filename,
Expand Down Expand Up @@ -220,6 +265,9 @@ int uv__fsevents_close(uv_fs_event_t* handle) {


uv_mutex_destroy(&handle->cf_mutex); uv_mutex_destroy(&handle->cf_mutex);
uv_sem_destroy(&handle->cf_sem); uv_sem_destroy(&handle->cf_sem);
free(handle->realpath);
handle->realpath = NULL;
handle->realpath_len = 0;


return 0; return 0;
} }
6 changes: 3 additions & 3 deletions deps/uv/src/unix/kqueue.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ int uv_fs_event_init(uv_loop_t* loop,
struct stat statbuf; struct stat statbuf;
#endif /* defined(__APPLE__) */ #endif /* defined(__APPLE__) */


/* We don't support any flags yet. */
assert(!flags);

/* TODO open asynchronously - but how do we report back errors? */ /* TODO open asynchronously - but how do we report back errors? */
if ((fd = open(filename, O_RDONLY)) == -1) { if ((fd = open(filename, O_RDONLY)) == -1) {
uv__set_sys_error(loop, errno); uv__set_sys_error(loop, errno);
Expand All @@ -112,6 +109,9 @@ int uv_fs_event_init(uv_loop_t* loop,
#if defined(__APPLE__) #if defined(__APPLE__)
/* Nullify field to perform checks later */ /* Nullify field to perform checks later */
handle->cf_eventstream = NULL; handle->cf_eventstream = NULL;
handle->realpath = NULL;
handle->realpath_len = 0;
handle->cf_flags = flags;


if (fstat(fd, &statbuf)) if (fstat(fd, &statbuf))
goto fallback; goto fallback;
Expand Down
3 changes: 0 additions & 3 deletions deps/uv/src/unix/linux/inotify.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -176,9 +176,6 @@ int uv_fs_event_init(uv_loop_t* loop,
int events; int events;
int wd; int wd;


/* We don't support any flags yet. */
assert(!flags);

if (init_inotify(loop)) return -1; if (init_inotify(loop)) return -1;


events = UV__IN_ATTRIB events = UV__IN_ATTRIB
Expand Down
8 changes: 4 additions & 4 deletions deps/uv/src/unix/pipe.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ void uv__pipe_close(uv_pipe_t* handle) {
} }




void uv_pipe_open(uv_pipe_t* handle, uv_file fd) { int uv_pipe_open(uv_pipe_t* handle, uv_file fd) {
uv__stream_open((uv_stream_t*)handle, return uv__stream_open((uv_stream_t*)handle,
fd, fd,
UV_STREAM_READABLE | UV_STREAM_WRITABLE); UV_STREAM_READABLE | UV_STREAM_WRITABLE);
} }




Expand Down
47 changes: 7 additions & 40 deletions deps/uv/src/unix/stream.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -386,16 +386,6 @@ void uv__stream_destroy(uv_stream_t* stream) {
} }




static void uv__next_accept(uv_idle_t* idle, int status) {
uv_stream_t* stream = idle->data;

uv_idle_stop(idle);

if (stream->accepted_fd == -1)
uv__io_start(stream->loop, &stream->read_watcher);
}


/* Implements a best effort approach to mitigating accept() EMFILE errors. /* Implements a best effort approach to mitigating accept() EMFILE errors.
* We have a spare file descriptor stashed away that we close to get below * We have a spare file descriptor stashed away that we close to get below
* the EMFILE limit. Next, we accept all pending connections and close them * the EMFILE limit. Next, we accept all pending connections and close them
Expand Down Expand Up @@ -497,40 +487,17 @@ void uv__server_io(uv_loop_t* loop, uv__io_t* w, int events) {
stream->accepted_fd = fd; stream->accepted_fd = fd;
stream->connection_cb(stream, 0); stream->connection_cb(stream, 0);


if (stream->accepted_fd != -1 || if (stream->accepted_fd != -1) {
(stream->type == UV_TCP && stream->flags == UV_TCP_SINGLE_ACCEPT)) {
/* The user hasn't yet accepted called uv_accept() */ /* The user hasn't yet accepted called uv_accept() */
uv__io_stop(loop, &stream->read_watcher); uv__io_stop(loop, &stream->read_watcher);
break; return;
} }
}


if (stream->fd != -1 && if (stream->type == UV_TCP && (stream->flags & UV_TCP_SINGLE_ACCEPT)) {
stream->accepted_fd == -1 && /* Give other processes a chance to accept connections. */
(stream->type == UV_TCP && stream->flags == UV_TCP_SINGLE_ACCEPT)) struct timespec timeout = { 0, 1 };
{ nanosleep(&timeout, NULL);
/* Defer the next accept() syscall to the next event loop tick. }
* This lets us guarantee fair load balancing in in multi-process setups.
* The problem is as follows:
*
* 1. Multiple processes listen on the same socket.
* 2. The OS scheduler commonly gives preference to one process to
* avoid task switches.
* 3. That process therefore accepts most of the new connections,
* leading to a (sometimes very) unevenly distributed load.
*
* Here is how we mitigate this issue:
*
* 1. Accept a connection.
* 2. Start an idle watcher.
* 3. Don't accept new connections until the idle callback fires.
*
* This works because the callback only fires when there have been
* no recent events, i.e. none of the watched file descriptors have
* recently been readable or writable.
*/
uv_tcp_t* tcp = (uv_tcp_t*) stream;
uv_idle_start(tcp->idle_handle, uv__next_accept);
} }
} }


Expand Down
2 changes: 0 additions & 2 deletions deps/uv/src/unix/sunos.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -196,8 +196,6 @@ int uv_fs_event_init(uv_loop_t* loop,
int portfd; int portfd;
int first_run = 0; int first_run = 0;


/* We don't support any flags yet. */
assert(!flags);
if (loop->fs_fd == -1) { if (loop->fs_fd == -1) {
if ((portfd = port_create()) == -1) { if ((portfd = port_create()) == -1) {
uv__set_sys_error(loop, errno); uv__set_sys_error(loop, errno);
Expand Down
Loading

2 comments on commit 7fcb7b4

@brainpicture
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bnoordhuis
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jbergstroem Is it possible that the machine is running a debug build now?

Please sign in to comment.