ignoreDisconnectIntercept() runs on every datagram the control stream socket receives, before ENet has validated the packet. It only checked the length and command, so any 12-byte DISCONNECT from any source set disconnectPending, which tears down the session about a second later. Check that the header's peer ID and session ID match our peer and that the packet came from the peer's current address before acting on it. Anything else is passed to ENet unchanged, so a genuine disconnect that does not match (for example from another address of a multi-homed host) is still handled, just without the grace period.
Moonlight Streaming Core Library
Moonlight-common-c contains the core GameStream client code shared between Moonlight clients, including Moonlight PC, Moonlight Android, Moonlight iOS, and Moonlight Chrome.
If you are implementing your own Moonlight game streaming client that can use a C library, you probably want the code here.
Note to Developers
Moonlight-common-c requires the specific version of ENet that is bundled as a submodule. This version has changes required for IPv6 compatibility and retransmission reliability, among other things. These are breaking API/ABI changes which make Moonlight-common-c incompatible with other versions of the ENet library. Attempting to runtime link to another libenet library will cause your client to crash when connecting to recent versions of GeForce Experience.