If one side of the communications dies mid-transfer, it could get "out of sync" with the state machine's idea of what things should look like.
One approach could be to have a SOF byte and an escape byte. If either of those bytes need to appear in the stream, send the escape byte and invert the bits of the required byte.
Thus, if you receive a SOF mid-message, you know the message is bad and to restart the state machine.
Thoughts?