-
Notifications
You must be signed in to change notification settings - Fork 849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
windows (mingw-w64) support for libh2o #380
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,11 +87,16 @@ static void init_async(h2o_multithread_queue_t *queue, h2o_loop_t *loop) | |
{ | ||
int fds[2]; | ||
|
||
#ifndef _WIN32 | ||
if (cloexec_pipe(fds) != 0) { | ||
perror("pipe"); | ||
abort(); | ||
} | ||
fcntl(fds[1], F_SETFL, O_NONBLOCK); | ||
#else | ||
u_long nonblock = 1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Call to I presume that this is the reason why you are seeing timeout errors. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you look a few lines above this is only relevant for the evloop implementation With reguard to the evloop implementation I do need some advice here :) I think I should focus on supporting doing 1 of the 2 first and not both at the same time. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In the unix-side, fds[0] and fds[1] are initialized by calling The file descriptors being created are used for signalling between the threads, and the threads listen to the sockets using the event loop. So I think on Windows you would need to create a pair of TCP sockets connected to each other under my understanding that the HANDLEs created by There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The H2O standalone server only supports the embedded event loop (evloop). Libuv binding exists for users of libh2o (since it is a popular event loop that is used, with rich documentation and other protocol bindings that application developers can use). I agree that porting the libuv-side would be faster, but if your intention is to make the H2O standalone server runnable on Windows, you would need to port evloop (and it seems like that you have already done that to some extent!). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes I did this yesterday evening using the socket function and making it a stream socket with ipv4 support and tcp but it didn't change much in that the in ev-loop mode example-httpclient hangs (still stuck in the loop) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes I started working on that because I couldn't get the examples that use libuv working :( I still intend to get the full h2o package working on windows but I would like to focus on the lib aspect first. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
To which part of the callbacks does the client proceed? exmaples/libh2o/http1client.c defines a number of callbacks that are called one by one. That would help you analyze the cause of the issue.
That depends on what you want to do. If your intention is to use libh2o, then you should better concentrate on libh2o and the examples under examples/libh2o. OTOH if your intention is porting the standalone server to Windows, I would suggest concentrating on evloop and then working on the libuv-side. Personally I did not expect somebody to start porting the standalone server to Windows, and am fascinated by how far you have achieved so far. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When using libuv on_connect is called and it doesn't complain and that comes from a call stack of 1 on_connect then after that it hits on_head and exits on line 108 after fprintf "I/O timeout" the stack for this is 1 on_head After debugging in fiddler2 the http req debugger I can see that the http request is infact never made to argv[1] in my case hxxp://google.com (xx = tt) now the only strange piece of code left is this I tried using _get_osfhanle but it doesn't change anything :/ I'm not quite sure whats going on here exactly.
I would like to get the lib working first, but I do intend to get the server working after that :)
Someone was bound to try it sooner or later :D |
||
ioctlsocket(fds[1], FIONBIO, &nonblock); | ||
#endif | ||
queue->async.write = fds[1]; | ||
queue->async.read = h2o_evloop_socket_create(loop, fds[0], NULL, 0, 0); | ||
queue->async.read->data = queue; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move the includes and defines (e.g.
AI_ADDRCONFIG
) mandatory to use the functions provided by hostinfo.h to hostinfo.h, instead of repeating the definitions in each source file.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I agree this makes sense.
done: haven't pushed changes yet as we need to address all the issues