this should fix an issue where the server exits prematurely. I had an
if without an else clause, so it was exiting without checking for the timeout.