Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The way my mud did it, and I believe most muds (considering I took my implementation from another popular codebase), was not by forking. Sockets are just files, so all we did was save everything including players, execl() another instance of the MUD, and exit. Same port wasn't an issue with SO_REUSEADDR.

On boot as it's loading players, their file descriptor ID was saved, so it loads it up and resumes talking to the socket. It also loads the ID of the server socket descriptor. No need to send information to a new process as it just loads the previous game state.

If you're curious: https://github.com/borlak/acmud/blob/7c2442dfccfc28364fc399a...

And: https://github.com/borlak/acmud/blob/7c2442dfccfc28364fc399a...



That sounds so much nicer than that horrific hack in the OP.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: