[WIP] add server-side C API#2807
Conversation
seanmonstar
left a comment
There was a problem hiding this comment.
Thanks for submitting this, this looks like a nice start! I left some comments inline to continue the discussion. <3
| use super::io::hyper_io; | ||
| use super::task::{hyper_executor, hyper_task, WeakExec}; | ||
|
|
||
| pub struct hyper_http(Http<WeakExec>); |
There was a problem hiding this comment.
You couldn't know this, but I'm not a fan of the name that's currently Http in hyper. I think this C API type might want to follow the client-side naming, so maybe hyper_serverconn_options? And then similarly with the related functions.
| } | ||
|
|
||
| type hyper_service_callback = | ||
| extern "C" fn(*mut c_void, *mut hyper_request, *mut hyper_response) -> (); |
There was a problem hiding this comment.
So, it looks like this would require that in C, the callback is synchronous. It must return a response, it can't return a future. I worry that this might make servers in C just do everything in a blocking style, which would be bad for the server.
Would it be hard to have this callback return a *mut hyper_task? I haven't thought too hard about it
Related to #2797. The API can be called but does not really work yet.
Since I am not yet familiar with the whole project, I would like to hear more advice from the community, especially those who previously worked on the C API.