headers/main.c: Update to new handler interface
This commit is contained in:
parent
b94f76033f
commit
bc1d77983a
|
@ -44,7 +44,6 @@ static int on_length(const unsigned long long len,
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int ret = EXIT_FAILURE;
|
int ret = EXIT_FAILURE;
|
||||||
const short port = 8080;
|
|
||||||
const struct handler_cfg cfg =
|
const struct handler_cfg cfg =
|
||||||
{
|
{
|
||||||
.length = on_length,
|
.length = on_length,
|
||||||
|
@ -67,12 +66,22 @@ int main(int argc, char *argv[])
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handler_listen(h, port))
|
unsigned short port;
|
||||||
|
|
||||||
|
if (handler_listen(h, 0, &port))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: handler_listen failed\n", __func__);
|
fprintf(stderr, "%s: handler_listen failed\n", __func__);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("Listening on port %hu\n", port);
|
||||||
|
|
||||||
|
if (handler_loop(h))
|
||||||
|
{
|
||||||
|
fprintf(stderr, "%s: handler_loop failed\n", __func__);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
ret = EXIT_SUCCESS;
|
ret = EXIT_SUCCESS;
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
|
Loading…
Reference in New Issue