History log of /libuv/src/unix/stream.c (Results 176 – 200 of 251)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 65bb6f06 15-Nov-2012 Ben Noordhuis

unix: rename UV__IO_* constants

# 1282d648 22-Aug-2012 Ben Noordhuis

unix: remove dependency on libev

# 0ddf9d6b 04-Nov-2012 Ben Noordhuis

Revert "unix: use select() for specific fds on OS X"

This reverts commit 5da380a5ca7f9ef02667ef3021fc97428df0b478.

Contains a bug that effectively makes the select() thread busy-loo

Revert "unix: use select() for specific fds on OS X"

This reverts commit 5da380a5ca7f9ef02667ef3021fc97428df0b478.

Contains a bug that effectively makes the select() thread busy-loop. The file
descriptor is polled for both reading and writing, regardless of what events
the main thread wants to receive. Fixing that requires proper synchronization
between the two threads.

See #614.

show more ...

# 914185d6 03-Nov-2012 Ben Noordhuis

unix: make some internal methods static

# c666b631 02-Oct-2012 Ben Noordhuis

unix: fix uninitialized memory read in uv__read()

This commit fixes the following valgrind warning:

==26443== Conditional jump or move depends on uninitialised value(s)
==26

unix: fix uninitialized memory read in uv__read()

This commit fixes the following valgrind warning:

==26443== Conditional jump or move depends on uninitialised value(s)
==26443== at 0x44AAFF: uv__read (stream.c:872)
==26443== by 0x44ADD4: uv__stream_io (stream.c:1051)
==26443== by 0x4377B8: uv__io_rw (core.c:539)
==26443== by 0x43C761: ev_invoke_pending (ev.c:2145)
==26443== by 0x43724D: uv__poll (core.c:260)
==26443== by 0x437297: uv__run (core.c:269)
==26443== by 0x4372F6: uv_run (core.c:277)
==26443== by 0x42094B: run_test_pipe_ref4 (test-ref.c:334)
==26443== by 0x406551: run_test_part (runner.c:302)
==26443== by 0x405384: main (run-tests.c:57)

show more ...

# be2a2176 17-Sep-2012 Ben Noordhuis

unix: rethink relaxed accept() approach

Benchmarks demonstrated that the idle timer handle approach didn't balance the
load quite fair enough, the majority of new connections still ended

unix: rethink relaxed accept() approach

Benchmarks demonstrated that the idle timer handle approach didn't balance the
load quite fair enough, the majority of new connections still ended up in one
or two processes.

The new approach voluntarily gives up a scheduler timeslice by calling
nanosleep() with a one nanosecond timeout.

Why not sched_yield()? Because on Linux (and this is probably true for other
Unices as well), sched_yield() only yields if there are other processes running
on the same CPU.

nanosleep() on the other hand always forces the process to sleep, which gives
other processes a chance to accept our pending connections.

show more ...

# b7047d67 12-Sep-2012 Saúl Ibarra Corretgé

unix: remove __read_mostly macro

It creates trouble with llvm-gcc on OS X.

# 4f5c8da1 10-Sep-2012 Ben Noordhuis

unix: reimplement accept() EMFILE trick

Implement a best effort approach to mitigating accept() EMFILE errors.

We have a spare file descriptor stashed away that we close to get belo

unix: reimplement accept() EMFILE trick

Implement 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
immediately to signal the clients that we're overloaded - and we are, but
we still keep on trucking.

There is one caveat: it's not reliable in a multi-threaded environment.
The file descriptor limit is per process. Our party trick fails if another
thread opens a file or creates a socket in the time window between us
calling close() and accept().

Fixes #315.

show more ...

# 86cb5203 10-Sep-2012 Ben Noordhuis

unix: fix EMFILE busy loop

Don't spin in epoll_wait() / kevent() / port_getn() / etc. when we can't
accept() a new connection due to having reached the file descriptor limit.
Pass th

unix: fix EMFILE busy loop

Don't spin in epoll_wait() / kevent() / port_getn() / etc. when we can't
accept() a new connection due to having reached the file descriptor limit.
Pass the error to the connection_cb and let the libuv user deal with it.

show more ...

# e89cb907 23-Aug-2012 Ben Noordhuis

unix: fix aliasing warnings in stream.c

# 5da380a5 16-Aug-2012 Fedor Indutny

unix: use select() for specific fds on OS X

kqueue(2) on osx doesn't work (emits EINVAL error) with specific fds
(i.e. /dev/tty, /dev/null, etc). When given such descriptors - start

unix: use select() for specific fds on OS X

kqueue(2) on osx doesn't work (emits EINVAL error) with specific fds
(i.e. /dev/tty, /dev/null, etc). When given such descriptors - start
select(2) watcher thread that will emit io events.

show more ...

# a7f7696a 17-Aug-2012 Ben Noordhuis

unix: remove UV_REQ_BUFSML_SIZE

Revision tags: node-v0.8.7
# 837edf4c 09-Aug-2012 Ben Noordhuis

unix, windows: remove handle init counters

Remove the handle init counters, no one uses them.

Revision tags: node-v0.8.6, node-v0.8.5, node-v0.6.21
# 9f7cdb20 29-Jul-2012 Ben Noordhuis

unix: add relaxed accept() setting

Mitigates unfair scheduling in multi-process setups that share a single listen
socket across multiple processes.

# be103243 29-Jul-2012 Ben Noordhuis

Merge branch 'v0.8'


# cf05c5f0 27-Jul-2012 Ben Noordhuis

Raise UV_ECANCELED on premature close.

Set the error code to the more appropriate UV_ECANCELED instead of UV_EINTR
when the handle is closed and there are in-flight requests.

Revision tags: node-v0.8.3, node-v0.9.0, node-v0.8.2
# cc1b3de2 01-Jul-2012 Ben Noordhuis

unix: revert 0971598, obsoleted by 889ab21

# 3b8c0da5 30-Jun-2012 Ben Noordhuis

unix: fix busy loop on unexpected tcp message

Don't start reading immediately after connecting. If the server sends a message
and the client hasn't called uv_read_start() yet, the event

unix: fix busy loop on unexpected tcp message

Don't start reading immediately after connecting. If the server sends a message
and the client hasn't called uv_read_start() yet, the event loop will busy loop
because the pending message keeps waking it up.

show more ...

# 0971598d 29-Jun-2012 Ben Noordhuis

unix: fix EINPROGRESS busy loop

Don't make the event loop spin when connect() returns EINPROGRESS.

Test case:

#include "uv.h"

static void connect_cb(uv_connect

unix: fix EINPROGRESS busy loop

Don't make the event loop spin when connect() returns EINPROGRESS.

Test case:

#include "uv.h"

static void connect_cb(uv_connect_t* req, int status) {
// ...
}

int main() {
uv_tcp_t handle;
uv_connect_t req;
struct sockaddr_in addr;
addr = uv_ip4_addr("8.8.8.8", 1234); // unreachable
uv_tcp_init(uv_default_loop(), &handle);
uv_tcp_connect(&req, (uv_stream_t*)&handle, addr, connect_cb);
uv_run(uv_default_loop()); // busy loops until connection times out
return 0;
}

After EINPROGRESS, there are zero active handles and one active request. That
in turn makes uv__poll_timeout() believe that it should merely poll, not block,
in epoll() / kqueue() / port_getn().

Sidestep that by artificially starting the handle on connect() and stopping it
again once the TCP handshake completes / is rejected / times out.

It's a slightly hacky approach because I don't want to change the ABI of the
stable branch. I'll address it properly in the master branch.

show more ...

# e4a68bb5 29-Jun-2012 Ben Noordhuis

unix: move uv__connect() to tcp.c

Revision tags: node-v0.8.1
# 4d42af20 26-Jun-2012 Ben Noordhuis

unix: don't create connect req when connect() fails

Fixes a lifecycle issue where the req got created, added to the list of active
reqs but wasn't properly activated because uv__connect(

unix: don't create connect req when connect() fails

Fixes a lifecycle issue where the req got created, added to the list of active
reqs but wasn't properly activated because uv__connect() returned early.

show more ...

Revision tags: node-v0.8.0, node-v0.7.12, node-v0.7.11
# 23b4e38d 08-Jun-2012 Ben Noordhuis

unix: make uv_shutdown() return UV_ENOTCONN

Return UV_ENOTCONN when the stream is not connected, not UV_EINVAL. Aligns
with uv-win.

Revision tags: node-v0.7.10, node-v0.6.19
# 738b31eb 05-Jun-2012 Ben Noordhuis

unix: fix loop starvation under high network load

uv__read() and uv__udp_recvmsg() read incoming data in a loop. If data comes
in at high speeds, the kernel receive buffer never drains a

unix: fix loop starvation under high network load

uv__read() and uv__udp_recvmsg() read incoming data in a loop. If data comes
in at high speeds, the kernel receive buffer never drains and said functions
never terminate, stalling the event loop indefinitely. Limit the number of
consecutive reads to 32 to stop that from happening.

The number 32 was chosen at random. Empirically, it seems to maintain a high
throughput while still making the event loop move forward at a reasonable pace.

show more ...

# cb9ca142 04-Jun-2012 Ben Noordhuis

unix: queue write reqs if stream is not connected

# 58a272e5 29-May-2012 Ben Noordhuis

unix: rework pending handle/req logic

1234567891011