Code extracted from: https://github.com/GTkorvo/enet.git at commit c504fed3463bd45a1dce52510a1f878405f77c35 (master).