Misplaced #endif causes Win32 compile to fail.
Code should only be compiled when daemon support available. Specifically causes issues for Win32 compilation.