aboutsummaryrefslogtreecommitdiff
path: root/handler.c
diff options
context:
space:
mode:
authorxavi <xavi@noreply.localhost>2023-11-20 16:24:15 +0100
committerxavi <xavi@noreply.localhost>2023-11-20 16:24:15 +0100
commit44676b84fd9aa689e4abbb588bead19a36061fa1 (patch)
tree388e86e26531b1b6612e0a178fbd29cd89c86814 /handler.c
parent65031ca3502e0c27780be847fd97c112546741a9 (diff)
parent2561ec32fe24e9cc81151193fbf2c55c94078816 (diff)
Merge pull request 'Allow `listen_port` to return selected port number' (#1) from midokura-xavi/libweb:listen-port into master
Reviewed-on: https://gitea.privatedns.org/xavi/libweb/pulls/1
Diffstat (limited to 'handler.c')
-rw-r--r--handler.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/handler.c b/handler.c
index f6e47a3..4abbdb8 100644
--- a/handler.c
+++ b/handler.c
@@ -182,14 +182,20 @@ end:
return ret;
}
-int handler_listen(struct handler *const h, const unsigned short port)
+int handler_listen(struct handler *const h, const unsigned short port,
+ unsigned short *const outport)
{
- if (!(h->server = server_init(port)))
+ if (!(h->server = server_init(port, outport)))
{
fprintf(stderr, "%s: server_init failed\n", __func__);
return -1;
}
+ return 0;
+}
+
+int handler_loop(struct handler *const h)
+{
for (;;)
{
bool exit, io;