Commit Graph

12 Commits

Author SHA1 Message Date
Saúl Ibarra Corretgé
a87619ce63 unix, windows: move includes for EAI constants 2014-08-21 21:31:02 +02:00
Saúl Ibarra Corretgé
76cd67686c unix: fix exposing EAI_* glibc-isms 2014-08-21 16:48:45 +02:00
Alexis Campailla
c87c44fff3 windows: fix uv__getaddrinfo_translate_error
Use Windows socket error codes, as recommended by MSDN, like we already
do with GetNameInfoW.
2014-08-09 11:18:26 +02:00
Ben Noordhuis
3ee4d3f183 unix, windows: return error codes directly
This commit changes the libuv API to return error codes directly rather
than storing them in a loop-global field.

A code snippet like this one:

    if (uv_foo(loop) < 0) {
      uv_err_t err = uv_last_error(loop);
      fprintf(stderr, "%s\n", uv_strerror(err));
    }

Should be rewritten like this:

    int err = uv_foo(loop);
    if (err < 0)
      fprintf(stderr, "%s\n", uv_strerror(err));

The rationale for this change is that it should make creating bindings
for other languages a lot easier: dealing with struct return values is
painful with most FFIs and often downright buggy.
2013-07-07 09:51:00 +02:00
Ben Noordhuis
3a8c3987d6 sunos: fix syntax error introduced in 76d831e4
Moving around the code for #754 inadvertently introduced a syntax error
in a SunOS-only code path.

The syntax error didn't actually manifest at build time because
the #elif it was wrapped in was, alas, wrong as well.
2013-04-02 21:58:21 +02:00
Ben Noordhuis
76d831e4c8 unix: getaddrinfo_cb status arg should be 0 or -1
The documentation in uv.h states that the status argument to the
uv_getaddrinfo() callback is either 0 or -1 but uv-unix actually
passed it the addrinfo error code. Rectify that and add a regression
test.

Fixes #754.
2013-03-26 22:30:46 +01:00
Ben Noordhuis
edd10071eb unix: fix up #if defined checks
`#if FOO` (where FOO is undefined) is a legal construct in C89 and C99
but gcc, clang and sparse complain loudly about it at higher warning
levels.

Squelch those warnings. Makes the code more consistent as well.
2013-01-06 22:31:47 +01:00
Ben Noordhuis
92fb84b751 unix: rework uv_cancel() api
Bert Belder informs me the current approach where a request is immediately
cancelled, is impossible to implement on Windows.

Rework the API to always invoke the "done" callback with an UV_ECANCELED error
code.
2012-12-13 13:46:38 +01:00
Ben Noordhuis
52c8a8617d unix: add uv_cancel() 2012-12-09 15:12:42 +01:00
Ben Noordhuis
44f0fcd033 Merge branch 'v0.8'
Conflicts:
	src/unix/core.c
2012-11-29 23:34:43 +01:00
Ben Noordhuis
36c91e3ba0 unix: port getaddrinfo to new thread pool 2012-10-01 22:53:59 +02:00
Ben Noordhuis
7ac23ee0c6 unix: move getaddrinfo code to getaddrinfo.c 2012-09-28 08:05:53 +02:00