diff options
| author | Garrett D'Amore <garrett@damore.org> | 2025-01-05 16:46:03 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2025-01-06 13:58:07 -0800 |
| commit | f42d0c6ef956d119e8762a3ecda37886fa055637 (patch) | |
| tree | 1744a559dafafdfecd906608888bf0cb9f6c4d10 /src/supplemental/http/http_public.c | |
| parent | bce6a79fc55852032e9d653b099a121353aaa238 (diff) | |
| download | nng-f42d0c6ef956d119e8762a3ecda37886fa055637.tar.gz nng-f42d0c6ef956d119e8762a3ecda37886fa055637.tar.bz2 nng-f42d0c6ef956d119e8762a3ecda37886fa055637.zip | |
http: server callback API simplified
This simplified API lets callbacks obtain the response from the
connection objection directly, and does not require the aio to carry
it as a parameter. Further, the request and response are both
stored inline in the connection, reducing allocations.
This is at present only for the server; the client will get a similar
set of changes.
Diffstat (limited to 'src/supplemental/http/http_public.c')
| -rw-r--r-- | src/supplemental/http/http_public.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/supplemental/http/http_public.c b/src/supplemental/http/http_public.c index 8a81404e..dd35151a 100644 --- a/src/supplemental/http/http_public.c +++ b/src/supplemental/http/http_public.c @@ -482,25 +482,23 @@ nng_http_conn_write_req(nng_http_conn *conn, nng_http_req *req, nng_aio *aio) } void -nng_http_conn_write_res(nng_http_conn *conn, nng_http_res *res, nng_aio *aio) +nng_http_conn_write_res(nng_http_conn *conn, nng_aio *aio) { #ifdef NNG_SUPP_HTTP - nni_http_write_res(conn, res, aio); + nni_http_write_res(conn, aio); #else NNI_ARG_UNUSED(conn); - NNI_ARG_UNUSED(res); nni_aio_finish_error(aio, NNG_ENOTSUP); #endif } void -nng_http_conn_read_req(nng_http_conn *conn, nng_http_req *req, nng_aio *aio) +nng_http_conn_read_req(nng_http_conn *conn, nng_aio *aio) { #ifdef NNG_SUPP_HTTP - nni_http_read_req(conn, req, aio); + nni_http_read_req(conn, aio); #else NNI_ARG_UNUSED(conn); - NNI_ARG_UNUSED(req); nni_aio_finish_error(aio, NNG_ENOTSUP); #endif } @@ -519,7 +517,7 @@ nng_http_conn_read_res(nng_http_conn *conn, nng_http_res *res, nng_aio *aio) int nng_http_handler_alloc( - nng_http_handler **hp, const char *uri, void (*cb)(nng_aio *)) + nng_http_handler **hp, const char *uri, nng_http_handler_func cb) { #ifdef NNG_SUPP_HTTP return (nni_http_handler_init(hp, uri, cb)); |
