diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2018-04-13 21:23:34 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2018-04-13 21:23:34 +0200 |
commit | ecf35293f80bba8b83a0dbf28f097812aa4353cb (patch) | |
tree | 51f8dea80d0fda06e85b2f910f76a9ea872d2fa5 /src/main.c | |
parent | 0e9015400269e004d8dbe006d47fa9e4556603ec (diff) |
POTD skeleton #3.
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -1,5 +1,6 @@ #include "log.h" #include "log_colored.h" +#include "thread_mgmt.h" #include "server.h" #include "server_ssh.h" #ifdef HAVE_CONFIG_H @@ -20,12 +21,13 @@ int main(int argc, char *argv[]) LOG_SET_FUNCS_VA(LOG_COLORED_FUNCS); N("%s (C) 2018 Toni Uhlig (%s)", PACKAGE_STRING, PACKAGE_BUGREPORT); + thread_manager_init(8); memset(&srv[0], 0, sizeof(srv)); ssh_ports[0] = "2222"; ssh_ports[1] = "2223"; ssh_ports[2] = "22050"; - for (int i = 0; i < srv_siz; ++i) { + for (size_t i = 0; i < srv_siz; ++i) { N("Initialising SSH server on port %s", ssh_ports[i]); ABORT_ON_FATAL( server_init_ctx(&srv[i], ssh_init_cb), @@ -46,11 +48,12 @@ int main(int argc, char *argv[]) } D2("%s", "Server epoll setup"); - epoll_fd = server_setup_epoll( (const server_ctx **) &srv, srv_siz ); - ABORT_ON_FATAL( epoll_fd >= 0, "Server epoll setup" ); + epoll_fd = server_setup_epoll( &srv[0], srv_siz ); + D2("epoll_fd: %d", epoll_fd); + ABORT_ON_FATAL( epoll_fd < 0, "Server epoll setup" ); - D2("%s", "Server epoll mainloop"); - ABORT_ON_FATAL( server_mainloop_epoll( epoll_fd, (const server_ctx **) &srv, srv_siz ), + N("%s", "Server epoll mainloop"); + ABORT_ON_FATAL( server_mainloop_epoll( epoll_fd, &srv[0], srv_siz ), "Server epoll mainloop" ); return 0; } |