move guts of SCT daemon to new function, shared by the two daemon implementations (child process vs. thread)