ssh_terminal: fixed race condition during startup

Moved creating ssh loop thread after initialization of wake up server
file descriptors to make sure that they will be properly handled even in
first loop run.

Issue #4095
This commit is contained in:
Tomasz Gajewski 2021-05-18 00:56:07 +02:00 committed by Christian Helmuth
parent b3a229eebb
commit 0b641ba581

View File

@ -117,11 +117,6 @@ Ssh::Server::Server(Genode::Env &env,
throw Init_failed();
}
if (pthread_create(&_event_thread, nullptr, _server_loop, this)) {
Genode::error("could not create event thread");
throw Init_failed();
}
/* add pipe to wake up loop on late connecting terminal */
if (pipe(_server_fds) ||
ssh_event_add_fd(_event_loop,
@ -133,6 +128,11 @@ Ssh::Server::Server(Genode::Env &env,
throw -1;
}
if (pthread_create(&_event_thread, nullptr, _server_loop, this)) {
Genode::error("could not create event thread");
throw Init_failed();
}
Genode::log("Listen on port: ", _port);
}); /* Libc::with_libc */
}