Fix #1: If a message is successfully sent but the sendq_move_to_sendmarkq(...) operation fails, it will be resent indefinitely
Restructure build system into multiple directories.

This additionally adds a unit test for #1.