server: reorganize code and return 0 on success
server: document code
server: implement threaded accepts
struct must be in .h