Commit Graph

281 Commits

Author SHA1 Message Date
Ryan Dahl
40efa9c731 win: Fix uv_getsockname for UDP 2011-08-24 17:40:35 -07:00
Bert Belder
1f28f81236 Fix mingw missing IPV6_V6ONLY 2011-08-24 15:38:51 +02:00
Bert Belder
1870c18f3c win: change uv_getsockname signature to support udp 2011-08-24 04:55:08 +02:00
Bert Belder
5c9d749a57 win: udp support 2011-08-24 04:55:08 +02:00
Ben Noordhuis
36ce74f2ca Add UDP support to libuv. 2011-08-24 04:55:01 +02:00
Ben Noordhuis
52024061e4 Make uv_getsockname() operate on uv_handle_t handles. 2011-08-24 04:17:36 +02:00
Bert Belder
5cae6e4e57 win: use uv_req_t.overlapped.Internal field to propagate request errors 2011-08-23 21:24:14 +02:00
Bert Belder
811828719f win: store the tcp deferred bind error in uv_tcp_t.bind_error, remove uv_handle_t.error 2011-08-23 20:41:16 +02:00
Bert Belder
b931e93c3f win: get rid of deferring bind errors for uv_pipe_t
It doesn't work anyway
2011-08-23 20:41:15 +02:00
Bert Belder
a8d2613ba0 win: integrate uv_close_error into uv_close 2011-08-23 20:41:15 +02:00
Bert Belder
6622c35bc4 win: add ntstatus-to-winsock-error mapping 2011-08-23 20:41:14 +02:00
Bert Belder
301d9283ee trailing whitespace 2011-08-23 20:41:07 +02:00
Ryan Dahl
ce9171d41f unix: uv_read_start should fail if UV_CLOSING set 2011-08-22 19:29:08 -07:00
Ryan Dahl
bdd880e7fc unix: add a few asserts, cosmetic touch ups 2011-08-22 19:29:08 -07:00
Igor Zinkovsky
4e9edceb98 windows: temporarily disable non-zero reads 2011-08-22 15:59:44 -07:00
Jeroen Janssen
ce207917fd remove unused variable
Fixes #151
2011-08-22 10:50:29 -07:00
Bert Belder
062af9fea8 win: fix buffer leak when using non-zero tcp reads 2011-08-21 21:47:34 +02:00
Bert Belder
beaa676184 win: rename UV_HANDLE_TCP_ZERO_READ to UV_HANDLE_ZERO_READ 2011-08-21 21:47:28 +02:00
Bert Belder
e45284dd4a win: prototype ordering 2011-08-21 21:46:50 +02:00
Bert Belder
d1a63c4003 win: move winsock intialization out of tcp.c 2011-08-21 21:46:40 +02:00
Bert Belder
48a8f1959a win: merge kernel32.h and ntdll.h; declare pointers in winapi.h 2011-08-21 21:46:20 +02:00
Bert Belder
cc0b0e6238 Remove trailing whitespace 2011-08-21 21:46:05 +02:00
Igor Zinkovsky
8448ee4bf6 Windows: Do simultaneous pending AcceptEx calls. 2011-08-18 17:45:59 -07:00
Igor Zinkovsky
56b09db2ed windows: set accept socket to INVALID_SOCKET in case of accept failure 2011-08-18 12:19:34 -07:00
Bert Belder
8ed2ffb2bf Windows: when searching path, look only for .com and .exe files 2011-08-18 04:08:27 +02:00
Igor Zinkovsky
422c139306 Windows: Pre-allocate buffers for overlapped WSARecv if the number of active tcp streams is below 50. 2011-08-17 17:44:54 -07:00
Ryan Dahl
e5a938f1f4 Add uv_buf_init() constructor 2011-08-17 17:43:19 -07:00
Jeroen Janssen
6b27bf9a86 uv_process_pipe_shutdown_req call should match prototype 2011-08-17 13:58:56 +02:00
Jeroen Janssen
a51f376655 added missing prototype for uv_process_pipe_shutdown_req 2011-08-17 13:58:56 +02:00
Jeroen Janssen
507c4ccea6 fixes for unsigned/signed comparison 2011-08-17 13:58:55 +02:00
Jeroen Janssen
0883b3d5fc remove unused variables 2011-08-17 13:58:54 +02:00
Igor Zinkovsky
e67b9a37a0 Skip IOCP for tcp operations that complete synchronously 2011-08-16 17:21:06 -07:00
Igor Zinkovsky
fc26321890 use GetQueuedCompletionStatusEx if the OS supports it 2011-08-15 12:13:47 -07:00
Bert Belder
38c2322378 Windows: ipv6 "any address" is ::0, not ::1 2011-08-15 05:52:50 +02:00
Bert Belder
c6c3d15d81 Windows: slightly improve error reporting 2011-08-15 04:25:39 +02:00
Ben Noordhuis
5020134568 uv-unix: remove unused variable 'iov' 2011-08-15 03:21:56 +02:00
Ben Noordhuis
035fd5beb0 eio: future-proof glibc version detection 2011-08-14 04:01:57 +02:00
Ben Noordhuis
5899192807 eio: fix HAVE_SYNC_FILE_RANGE heuristic on linux 2011-08-14 03:13:33 +02:00
Augusto Henrique Hentz
7f82995fb4 uv-unix: fix typo in definition of HAVE_PIPE2
The define HAVE_PIPE2 was always being set, even when the requisites
were not met.
2011-08-12 16:13:06 +02:00
Ryan Dahl
65f71a2039 Temp disable pipe2 on linux 2011-08-12 04:10:25 -04:00
Ben Noordhuis
1485c47999 eio: define HAVE_UTIMES 1 on freebsd, fixes build 2011-08-12 06:16:35 +02:00
Bert Belder
4c63f554a6 Windows: much better pipe_pound_1000 results 2011-08-12 02:44:02 +02:00
Bert Belder
89aa4078cc Windows: try to avoid using the thread pool for pipe shutdown 2011-08-12 02:44:01 +02:00
Bert Belder
a2ee4854c6 Windows: dynamically load some ntdll functions 2011-08-12 02:44:00 +02:00
Bert Belder
2d40e35b7e Style 2011-08-12 02:43:59 +02:00
Ryan Dahl
b44f9d75ea unix: cloexec stdio streams 2011-08-11 16:35:56 -07:00
Ryan Dahl
f7b4e65090 unix: introduce SPAWN_WAIT_EXEC to turn off poll feature 2011-08-11 15:52:22 -07:00
Ryan Dahl
11aa1ea096 Remove unnecessary casts 2011-08-11 11:27:35 -07:00
Bert Belder
ca633920f5 Windows: fix pipe shutdown 2011-08-11 04:18:29 +02:00
Bert Belder
a89410456c Whitespace 2011-08-11 04:18:28 +02:00
Ben Noordhuis
e8497aee5a Add error code UV_EPIPE. 2011-08-11 02:45:27 +02:00
Ben Noordhuis
b328e4cb05 uv-unix: fd 0 is valid file descriptor
uv__bind() and uv_tcp_listen() created a new socket
if tcp->fd <= 0 but 0 is a valid file descriptor.

The second bug was that the newly created socket
wasn't actually assigned to tcp->fd.

Fixes failing node.js test:
  test/simple/test-regress-GH-746.js
2011-08-11 01:36:20 +02:00
Ryan Dahl
ee2027dd13 fix preprocessor again 2011-08-10 16:16:47 -07:00
Ben Noordhuis
b6b97f305e uv-unix: guard against self-close by connection_cb
connection_cb may close the server socket inside the accept loop, handle it.

Fixes failing node.js tests:
  test/simple/test-net-connect-buffer.js
  test/simple/test-net-create-connection.js
2011-08-11 00:33:09 +02:00
Ben Noordhuis
afb1859600 uv-unix: remove dead code 2011-08-11 00:33:09 +02:00
Ryan Dahl
06623d15f2 More preprocessor fixes... 2011-08-10 15:01:38 -07:00
Ryan Dahl
dac30a15f2 More preprocessor fixes 2011-08-10 14:56:16 -07:00
Ryan Dahl
5dc8037fcf Fix mingw build by using preprocessor correctly. 2011-08-10 14:40:52 -07:00
Ryan Dahl
db190c7b4f unix: uv_pipe_connect should call uv__stream_open 2011-08-10 14:22:10 -07:00
Ryan Dahl
b8fe56d837 Remove unnecessary casts 2011-08-10 14:22:10 -07:00
Robert Mustacchi
4b1b8faea8 Clean up SunOS build 2011-08-09 23:51:50 +02:00
Peter Bright
3409c9b383 Include important Windows environmental variables even when a blank/custom environment is specified. 2011-08-09 14:29:51 -07:00
Ben Noordhuis
4abd1e0ccc uv-unix: close file descriptors immediately in uv_close()
Don't defer closing of socket and pipe file descriptors to the
next iteration of the event loop. It breaks node.js unit tests
that assume the call to `server.close()` immediately frees up
the bound to address.
2011-08-09 23:14:38 +02:00
Ben Noordhuis
0c815cfe89 eio: define HAVE_UTIMES 1 on cygwin, fixes build 2011-08-09 22:58:21 +02:00
Ryan Dahl
0266c0ec57 Change for MinGW on Win 2k3 2011-08-09 12:24:01 -07:00
Bert Belder
831b15a47c Windows: fix WaitNamedPipe thread bug 2011-08-09 17:35:18 +02:00
Peter Bright
648baa3826 Fix missing prototype warnings. 2011-08-08 18:11:01 -07:00
Ryan Dahl
1493dcf359 Peter Bright's MSVS fixes 2011-08-06 22:36:59 -07:00
Andrea Lattuada
6c3205557b Remove uv_flag_* functions in favor of manual bit twiddling
Fixes #121
Fixes #129
2011-08-06 12:12:25 -07:00
Ben Noordhuis
62d1c5751e uv-unix: fix warning: passing argument 1 of ‘eio_custom’ from incompatible pointer type 2011-08-06 17:01:09 +02:00
Ben Noordhuis
8abce89e57 build: fix libeio build on linux
Define HAVE_UTIMES so libeio includes <utime.h>
2011-08-06 14:43:50 +02:00
Ryan Dahl
52e1a9e997 Upgrade eio (it has better msvs support) 2011-08-06 00:29:39 -07:00
Igor Zinkovsky
cc143317b1 windows: fix req refcount for uv_pipe_connect 2011-08-05 17:47:20 -07:00
Ryan Dahl
4ca89308b6 Remove assert that is broken on darwin 2011-08-05 17:47:18 -07:00
Tom Hughes
76338f794e ares_parse_a_reply: fix memleak 2011-08-06 00:18:59 +02:00
Ryan Dahl
787ef5da80 uv-unix: Fix missing symbols on FreeBSD7 systems.
thanks Lenny
2011-08-05 11:58:11 -07:00
Ben Noordhuis
2fbcbe90c8 uv-unix: fix build on systems that don't have pipe2() 2011-08-05 17:12:02 +02:00
Bert Belder
c834d5de9e Windows: correct comment in process.c 2011-08-05 08:22:01 +02:00
Ben Noordhuis
041d60e141 uv-unix: avoid exec-after-fork race in uv_spawn()
The race condition in a nutshell:

    if ((pid = fork()) > 0) {
      kill(pid, SIGTERM);
    }
    else if (pid == 0) {
      execve("/bin/cat", argp, envp);
    }

The parent sends a signal immediately after forking.
Since the child may not have called `execve()` yet,
there is no telling what process receives the signal,
our fork or /bin/cat.

To avoid ambiguity, we create a pipe with both ends
marked close-on-exec. Then, after the call to `fork()`,
the parent polls the read end until it sees POLLHUP.
2011-08-05 04:09:20 +02:00
Peter Bright
d84b249616 Support for unescaped arguments, suitable for use with cmd /c.
Robust argument escaping that hopefully matches Windows' algorithm for unescaping.
2011-08-04 18:22:47 -07:00
Ben Noordhuis
c01d6f928c ev: fix infinite loop in ev_walk() 2011-08-04 19:03:47 +02:00
Bert Belder
642d97ced8 Windows: make process arguments buffer computation better 2011-08-03 02:09:37 +02:00
Bert Belder
ec143961d1 Windows: fix bug in process arguments buffer size computation 2011-08-03 01:42:32 +02:00
Bert Belder
dbaddc4423 Windows: avoid errorneous freeing of pipe handle 2011-08-03 00:18:12 +02:00
Ryan Dahl
b2ed24d86e unix: Remove flock code
solaris doesn't have flock
2011-08-02 07:08:13 +00:00
Ryan Dahl
22ec2db413 solaris fixes 2011-08-02 06:29:25 +00:00
Bert Belder
2e9a743da0 Windows: report uv_spawn() failure asynchronously 2011-08-01 20:24:54 -07:00
Igor Zinkovsky
6d940a3afc windows: remove dependency on rpcrt4 and ole32 libs. fixes https://github.com/joyent/libuv/issues/118 2011-08-01 20:10:55 -07:00
Igor Zinkovsky
0d29ea68c9 windows: fix for space in args 2011-08-01 16:41:08 -07:00
Ben Noordhuis
404d697dc4 uv-unix: undo accidental revert of b700896 in 5ec2575 2011-08-02 01:12:57 +02:00
Igor Zinkovsky
5af7423f90 always use PATH from parent 2011-08-01 14:28:39 -07:00
Ryan Dahl
5ec2575c0e unix: Add UV_READABLE, UV_WRITABLE flags; clean up uv_shutdown 2011-08-01 13:55:55 -07:00
Igor Zinkovsky
6c86f9e0a8 windows: get values of path and pathext env variables when they're not supplied 2011-08-01 13:40:48 -07:00
Ben Noordhuis
b7008965bc uv-unix: unlock pipe after use, carry over lock file from uv_pipe_bind() 2011-08-01 22:23:06 +02:00
Ben Noordhuis
d24403ac8e uv-unix: safely close pipe file descriptors 2011-08-01 18:06:20 +02:00
Ben Noordhuis
a3852a7d73 uv-unix: set stream->accepted_fd=-1 in uv_pipe_init()
stream->accepted_fd was zeroed in uv_pipe_init() and that made
uv__finish_close() close the stdin file descriptor. Not good.
2011-08-01 18:05:55 +02:00
Igor Zinkovsky
1d6117a89b windows: set mode for child pipe handle 2011-07-30 10:55:30 -07:00
Igor Zinkovsky
d272a2183d Windows: spawn child processes 2011-07-29 19:02:51 -07:00
Ryan Dahl
7108ca8853 uv_spawn requires stdio pipes to be initialized 2011-07-29 15:37:00 -07:00
Ben Noordhuis
eed6f395d1 pipe: uv_pipe_listen raises UV_EINVAL on unbound socket 2011-07-29 04:22:59 +02:00
Ben Noordhuis
8e8af8fd34 uv-unix: use lock file to detect stale UNIX sockets 2011-07-29 03:59:55 +02:00
Ben Noordhuis
3c057ff8e5 uv-unix: add simple lock file API for internal use 2011-07-29 03:59:55 +02:00
Ryan Dahl
cf5babef80 Fix getaddrinfo bug 2011-07-28 21:47:43 -04:00
Ryan Dahl
a0994ac8fb Fix solaris build 2011-07-28 23:41:39 +00:00
Tom Hughes
6203c932d4 Fix memleak in libeio. 2011-07-27 23:23:28 +02:00
Igor Zinkovsky
fc7bc2be70 fix mingw build; add stubs for child process API 2011-07-27 11:05:32 -07:00
Ben Noordhuis
a1adfe3e23 uv-unix: cast argument to uv__stream_open() to uv_stream_t* 2011-07-27 03:55:11 +02:00
Ryan Dahl
92bc7b4959 Start uv_spawn()
Unix only at the moment. Lacks test for stdio
2011-07-25 16:19:27 -04:00
Igor Zinkovsky
252da78830 uv_std_handle + uv_listen on stdin 2011-07-25 10:28:50 -07:00
Igor Zinkovsky
e7497227bd merge uv_tcp_listen and uv_pipe_listen into uv_listen 2011-07-22 16:57:09 -07:00
Ryan Dahl
84ebddad88 long lines 2011-07-22 03:35:12 -07:00
Bert Belder
2806b0386b Windows: do not initialize pipe handle in uv_pipe_accept 2011-07-22 12:08:27 +02:00
Ben Noordhuis
52487194cf uv-unix: fix 'comparison between signed and unsigned integer expressions' 2011-07-22 01:45:06 +02:00
Ben Noordhuis
272f164e6a uv-unix: uv_pipe_bind: raise UV_EACCESS on inaccessible socket
Fixes failing test pipe_bind_error_addrnotavail.
2011-07-21 19:48:42 +02:00
Igor Zinkovsky
186abb00bc windows: return UV_EACCESS for invalid pipe name 2011-07-21 10:39:08 -07:00
Ben Noordhuis
fb42f82df6 uv-unix: uv_pipe_bind: raise UV_EINVAL if pipe already bound
Fixes failing test pipe_bind_error_inval.
2011-07-21 18:18:34 +02:00
Ben Noordhuis
580a5b464f uv-unix: uv_pipe_listen: raise UV_ENOTCONN if pipe not bound
Fixes failing test pipe_listen_without_bind.
2011-07-21 18:18:34 +02:00
Ben Noordhuis
1028a9c6a7 uv-unix: handle EINTR properly
Fixes #113.
2011-07-21 15:22:59 +02:00
Bert Belder
5b532d5f60 Windows: do not hang if LOOP->refs become 0 in a prepare callback 2011-07-21 14:57:27 +02:00
Bert Belder
6e505766be Windows: follow libev loop semantics more closely 2011-07-21 04:25:01 +02:00
Igor Zinkovsky
f8bdddcda9 Allow pipe name to be in utf8 for uv_pipe_bind and uv_pipe_connect 2011-07-20 18:55:40 -07:00
Igor Zinkovsky
ee5236cf56 Windows: make uv_pipe_bind fail for the pipe name already in-use 2011-07-20 18:48:35 -07:00
Ben Noordhuis
c4611a4148 uv-unix: move stream->fd >= 0 asserts out of connection error path
on_connect callback must be invoked even if the connect() syscall
fails. stream->fd == -1 in that case.
2011-07-21 03:35:14 +02:00
Bert Belder
d9612fe0e7 More changes related to uv_close returning void 2011-07-21 03:27:43 +02:00
Ryan Dahl
b931c9313f uv_close returns void 2011-07-20 18:03:48 -07:00
Igor Zinkovsky
2765509430 Windows: Use PeekNamedPipe instead of non-blocking reads to peek at the pipe buffer 2011-07-21 02:25:09 +02:00
Ben Noordhuis
66f936bfd7 uv-unix: call uv__accept() instead of accept()
uv__accept() puts the socket in non-blocking close-on-exec mode,
accept() by itself does not.

Solves the case of the mysteriously hanging HTTP benchmarks.
2011-07-21 02:13:02 +02:00
Ben Noordhuis
332bbecd19 uv-unix: defer uv_pipe_connect callback to next tick 2011-07-20 23:06:44 +02:00
Ryan Dahl
1fda135ff2 understand EBADF 2011-07-20 11:05:53 -07:00
Ryan Dahl
eadfb14884 unix: uv_write shouldn't assert fd >= 0 2011-07-20 10:51:08 -07:00
Ben Noordhuis
ce5eb6d85a config-unix: drop --std=c89 on cygwin, hides CLOCK_MONOTONIC.
Fixes #112.
2011-07-20 17:58:27 +02:00
Ben Noordhuis
e6075842e8 uv-unix: in uv_pipe_init: zero the _whole_ uv_pipe_t struct. 2011-07-20 01:14:17 +02:00
Bert Belder
ca3cfbae74 Windows: use low-res event loop clock.
For much better performance. Closes #88.
2011-07-19 17:32:43 +02:00
Bert Belder
86f1ca90e5 Windows: implement uv_hrtime() 2011-07-19 15:01:12 +02:00
Bert Belder
cd0dcce98c Windows: use _strdup instead of strdup 2011-07-19 15:01:11 +02:00
Ben Noordhuis
7cc527997f uv-common: fix 'initialization discards qualifiers from pointer target type' 2011-07-19 13:51:31 +02:00
Ben Noordhuis
3207f8ae40 uv-unix: fix 'passing argument 1 of ‘uv__stream_open’ from incompatible pointer type' 2011-07-19 13:51:31 +02:00
Ben Noordhuis
c0d4669f87 uv-unix: fix 'implicit declaration of function ‘accept4’' 2011-07-19 13:51:31 +02:00
Ryan Dahl
d4563a197a Allow and test for lazy uv_tcp_listen 2011-07-19 02:40:54 -07:00
Bert Belder
3a91232f66 Split up uv-win.c 2011-07-19 03:47:30 +02:00
Ryan Dahl
07b49ce59a add uv_ip4_name and uv_ip6_name 2011-07-18 17:39:04 -07:00
Ben Noordhuis
4eff34da43 uv-unix: pipes API implementation
Based on UNIX sockets to avoid the vagaries of FIFOs
in asynchronous mode. Currently unlinks stale sockets
before binding and cleans them up again after shutdown.
2011-07-19 00:58:02 +02:00
Igor Zinkovsky
4d31f838b0 Windows: handle ERROR_PIPE_BUSY in uv_pipe_connect 2011-07-18 13:02:32 -07:00
Bert Belder
c1bddb9677 Stop g++ from complaining about anonymous struct usage 2011-07-16 00:33:31 +02:00
Bert Belder
d56af313ee Revert "uv_win: uv_pipe_connect should return -1 on error"
This reverts commit 7b4607348a.
2011-07-15 20:26:08 +02:00
Shigeki Ohtsu
1be48f12a0 ev: define HAVE_SYNC_FILE_RANGE if kernel >= 2.6.17 *and* glibc version >= 2.6 2011-07-15 15:44:20 +02:00
Henry Rawas
d540872107 uv-win: allow listen on unbound tcp handle 2011-07-15 02:49:34 +02:00
Bert Belder
7b4607348a uv_win: uv_pipe_connect should return -1 on error 2011-07-15 02:38:35 +02:00
Bert Belder
0ea4c87f8b Windows implementation of new request API
This changes uv-win to use the new uv_req subclasses.

It gets rid of the uv_req.flags field. There used to be only request flag
(UV_REQ_PENDING), and it was mostly obsolete; it only had a real purpose for
internal uv_read requests. Now we'll use the UV_HANDLE_READ_PENDING flag on
the handle instead.

This patch also simplifies the accept logic for named pipes on windows. We
no longer have a separate struct to store information about established
connections. Instead we just carry over the windows HANDLE from the accept
request to the client handle in uv_pipe_accept().
2011-07-14 10:46:08 -07:00
Ryan Dahl
abe0b1ea61 Better request API
Instead of uv_shutdown, uv_write, uv_connect taking raw uv_req_t we subclass
uv_req_t into uv_shutdown_t, uv_write_t, and uv_connect_t.

uv_req_init is removed.
2011-07-14 10:45:28 -07:00