Permalink
Browse files

Merge branch 'v0.9.2-release'

  • Loading branch information...
2 parents 90a6253 + 6e20558 commit 7fcb7b4d9cc9ac8ba4645bc6337a5af3ccc75496 @isaacs isaacs committed Sep 18, 2012
View
@@ -357,3 +357,10 @@ Gil Pedersen <git@gpost.dk>
Tyler Neylon <tylerneylon@gmail.com>
Golo Roden <webmaster@goloroden.de>
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>
View
@@ -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)
View
@@ -18,6 +18,7 @@
'OPENSSL_NO_SCTP',
'OPENSSL_NO_SOCK',
# Work around brain dead SunOS linker.
+ 'OPENSSL_NO_RDRAND',
'OPENSSL_NO_GOST',
'OPENSSL_NO_HW_PADLOCK',
'OPENSSL_NO_TTY',
@@ -353,7 +354,7 @@
'openssl/crypto/engine/eng_list.c',
'openssl/crypto/engine/eng_openssl.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_table.c',
'openssl/crypto/engine/tb_asnmth.c',
@@ -557,7 +558,6 @@
'openssl/crypto/sha/sha_one.c',
'openssl/crypto/srp/srp_lib.c',
'openssl/crypto/srp/srp_vfy.c',
- 'openssl/crypto/srp/srptest.c',
'openssl/crypto/stack/stack.c',
'openssl/crypto/store/str_err.c',
'openssl/crypto/store/str_lib.c',
@@ -41,6 +41,9 @@
ev_io event_watcher; \
int fflags; \
int fd; \
+ char* realpath; \
+ int realpath_len; \
+ int cf_flags; \
void* cf_eventstream; \
uv_async_t* cf_cb; \
ngx_queue_t cf_events; \
@@ -185,8 +185,7 @@ typedef struct {
int fd; \
UV_STREAM_PRIVATE_PLATFORM_FIELDS \
-#define UV_TCP_PRIVATE_FIELDS \
- uv_idle_t* idle_handle; /* for UV_TCP_SINGLE_ACCEPT handles */ \
+#define UV_TCP_PRIVATE_FIELDS /* empty */
#define UV_UDP_PRIVATE_FIELDS \
int fd; \
View
@@ -599,6 +599,11 @@ struct uv_tcp_s {
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. */
UV_EXTERN int uv_tcp_nodelay(uv_tcp_t* handle, int enable);
@@ -704,6 +709,11 @@ struct uv_udp_send_s {
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.
*
* Arguments:
@@ -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.
*/
-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);
@@ -1665,7 +1675,14 @@ enum uv_fs_event_flags {
* regular interval.
* 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
};
@@ -66,8 +66,13 @@ void uv__fsevents_cb(uv_async_t* cb, int status) {
handle = cb->data;
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);
+#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)
@@ -84,6 +89,8 @@ void uv__fsevents_event_cb(ConstFSEventStreamRef streamRef,
size_t i;
int len;
char** paths;
+ char* path;
+ char* pos;
uv_fs_event_t* handle;
uv__fsevents_event_t* event;
ngx_queue_t add_list;
@@ -99,17 +106,50 @@ void uv__fsevents_event_cb(ConstFSEventStreamRef streamRef,
kFSEventStreamEventFlagEventIdsWrapped |
kFSEventStreamEventFlagHistoryDone |
kFSEventStreamEventFlagMount |
- kFSEventStreamEventFlagUnmount)) {
+ kFSEventStreamEventFlagUnmount |
+ kFSEventStreamEventFlagRootChanged)) {
continue;
}
/* 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);
if (event == NULL)
break;
- memcpy(event->path, paths[i], len + 1);
+ memcpy(event->path, path, len + 1);
if (eventFlags[i] & kFSEventStreamEventFlagItemModified)
event->events = UV_CHANGE;
@@ -153,6 +193,11 @@ int uv__fsevents_init(uv_fs_event_t* handle) {
ctx.release = 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 */
path = CFStringCreateWithCString(NULL,
handle->filename,
@@ -220,6 +265,9 @@ int uv__fsevents_close(uv_fs_event_t* handle) {
uv_mutex_destroy(&handle->cf_mutex);
uv_sem_destroy(&handle->cf_sem);
+ free(handle->realpath);
+ handle->realpath = NULL;
+ handle->realpath_len = 0;
return 0;
}
@@ -93,9 +93,6 @@ int uv_fs_event_init(uv_loop_t* loop,
struct stat statbuf;
#endif /* defined(__APPLE__) */
- /* We don't support any flags yet. */
- assert(!flags);
-
/* TODO open asynchronously - but how do we report back errors? */
if ((fd = open(filename, O_RDONLY)) == -1) {
uv__set_sys_error(loop, errno);
@@ -112,6 +109,9 @@ int uv_fs_event_init(uv_loop_t* loop,
#if defined(__APPLE__)
/* Nullify field to perform checks later */
handle->cf_eventstream = NULL;
+ handle->realpath = NULL;
+ handle->realpath_len = 0;
+ handle->cf_flags = flags;
if (fstat(fd, &statbuf))
goto fallback;
@@ -176,9 +176,6 @@ int uv_fs_event_init(uv_loop_t* loop,
int events;
int wd;
- /* We don't support any flags yet. */
- assert(!flags);
-
if (init_inotify(loop)) return -1;
events = UV__IN_ATTRIB
View
@@ -156,10 +156,10 @@ void uv__pipe_close(uv_pipe_t* handle) {
}
-void uv_pipe_open(uv_pipe_t* handle, uv_file fd) {
- uv__stream_open((uv_stream_t*)handle,
- fd,
- UV_STREAM_READABLE | UV_STREAM_WRITABLE);
+int uv_pipe_open(uv_pipe_t* handle, uv_file fd) {
+ return uv__stream_open((uv_stream_t*)handle,
+ fd,
+ UV_STREAM_READABLE | UV_STREAM_WRITABLE);
}
View
@@ -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.
* 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
@@ -497,40 +487,17 @@ void uv__server_io(uv_loop_t* loop, uv__io_t* w, int events) {
stream->accepted_fd = fd;
stream->connection_cb(stream, 0);
- if (stream->accepted_fd != -1 ||
- (stream->type == UV_TCP && stream->flags == UV_TCP_SINGLE_ACCEPT)) {
+ if (stream->accepted_fd != -1) {
/* The user hasn't yet accepted called uv_accept() */
uv__io_stop(loop, &stream->read_watcher);
- break;
+ return;
}
- }
- if (stream->fd != -1 &&
- stream->accepted_fd == -1 &&
- (stream->type == UV_TCP && stream->flags == UV_TCP_SINGLE_ACCEPT))
- {
- /* 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);
+ if (stream->type == UV_TCP && (stream->flags & UV_TCP_SINGLE_ACCEPT)) {
+ /* Give other processes a chance to accept connections. */
+ struct timespec timeout = { 0, 1 };
+ nanosleep(&timeout, NULL);
+ }
}
}
View
@@ -196,8 +196,6 @@ int uv_fs_event_init(uv_loop_t* loop,
int portfd;
int first_run = 0;
- /* We don't support any flags yet. */
- assert(!flags);
if (loop->fs_fd == -1) {
if ((portfd = port_create()) == -1) {
uv__set_sys_error(loop, errno);
Oops, something went wrong.

2 comments on commit 7fcb7b4

Owner

bnoordhuis replied Oct 14, 2012

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

Please sign in to comment.