If anyone is interested on a native implementation of a client (and server)
with HTTP/2 support, I was working on it. I got nghttp2 working with async
networking, and also made a HTTP/1.1 pool to fall back if necessary. I haven't
published it yet, but if anyone is interested in more details, fee
If anyone is interested, I think I found a possible solution.
First, I took Araq's suggestion of wrapping the actual implementation of
callbacks inside a regular procedure: normally, if an exception gets thrown, it
will not be propagated like the C example, however, as I said previously, if
the
Already tested, same behavior
I've tried to use the async macro and it does work. However maybe it's not
optimal in this case, I don't know
I've decided to investigate further this behavior, so I set up a very simple
program that calls a C function and then a Nim one that is defined through
`cdecl`:
{.emit: """#include
#include
typedef struct {
void (*callback)();
} Scallback;
in
I did try to avoid possible issues: Initially, some objects used by libuv were
created as a `ref` object and then casted to `ptr` (which you shouldn't do it,
I know), but now `alloc` is always used so everything is correct. I have also
replaced the memory management functions used by the library
Pretty sure that by default libuv doesn't use any thread (apart from file IO,
but it's a different thing), and also if I switch to setjmp as the exception
backend, it also works. That's why I was wondering if that was some sort of a
bug, or just how it behaves
I don't think it's really a problem because I'm sure the checks above don't
generate any error, I have added the exception just to purposely throw an error
in any case.
The exception is checked by asyncCheck which is part of the asyncfutures
module. I have just tried to add nimTestErrorFlag on
I couldn't find anything about `nimTestErrorFlag`, so I supposed it was like a
built-in function initially. As a I said previously a possible solution to make
the program handle the exception is to stop the event loop by calling
`uv_stop`, but I couldn't find a way to add a global exception hand
As I have showed on the code, I do in fact already check if an error occurs. I
have tried to purposely throw an exception with also the `nimTestErrorFlag`,
but still nothing really changes.
proc onConnect(req: ptr uv_connect_t; status: cint) {.cdecl.} =
let fut = cast[Future
I was interested in bringing Libuv to Nim as an experiment to see how it would
work against native implementations. After getting it to compile correctly with
Nim's build system, I was able to create a simple TCP echo server. Then, I
encountered into a problem which I am still stuck with: except
11 matches
Mail list logo