@@ -1181,18 +1181,6 @@ int main(int argc, char *argv[])
usfstl_sched_add_job(&scheduler, &ctx.intf_job);
}
- if (time_socket) {
- usfstl_sched_ctrl_start(&ctrl, time_socket,
- 1000 /* nsec per usec */,
- (uint64_t)-1 /* no ID */,
- &scheduler);
- vusrv.scheduler = &scheduler;
- vusrv.ctrl = &ctrl;
- ctx.ctrl = &ctrl;
- } else {
- usfstl_sched_wallclock_init(&scheduler, 1000);
- }
-
if (vusrv.socket)
usfstl_vhost_user_server_start(&vusrv);
@@ -1213,6 +1201,18 @@ int main(int argc, char *argv[])
if (api_socket)
usfstl_uds_create(api_socket, wmediumd_api_connected, &ctx);
+ if (time_socket) {
+ usfstl_sched_ctrl_start(&ctrl, time_socket,
+ 1000 /* nsec per usec */,
+ (uint64_t)-1 /* no ID */,
+ &scheduler);
+ vusrv.scheduler = &scheduler;
+ vusrv.ctrl = &ctrl;
+ ctx.ctrl = &ctrl;
+ } else {
+ usfstl_sched_wallclock_init(&scheduler, 1000);
+ }
+
while (1) {
if (time_socket) {
usfstl_sched_next(&scheduler);
From: Johannes Berg <johannes.berg@intel.com> Some infrastructure that starts wmediumd might wait for it to start up by checking the sockets it should offer exist, yet have time stopped during startup for debug purposes. Initialize the time connection later so that the startup can happen regardless of such a scenario. Nothing can be processed on any of the sockets until we actually get to the mainloop anyway, so this is entirely safe. --- wmediumd/wmediumd.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)