I don't understand how segments are assign to message when they are received not in order.

It's been a while since i wrote that stuff, but it works.

Does any of that segments could be assigned to wrong message or even ommited (and corrupt whole RequestServiceAck)?

Sure, stuff could get corrupted, but it should be handled properly. If you find otherwise, let me know.