EllanJiang / GameFramework

This is literally a game framework, based on Unity game engine. It encapsulates commonly used game modules during development, and, to a large degree, standardises the process, enhances the development speed and ensures the product quality.
https://GameFramework.cn
MIT License
5.97k stars 1.45k forks source link

SendHeartBeat or !SendHeartBeat #42

Closed alexddhuang closed 5 years ago

alexddhuang commented 5 years ago

https://github.com/EllanJiang/GameFramework/blob/0416f39fde69b0f14ec12df2c6b6ad3207612f11/GameFramework/Network/NetworkManager.NetworkChannel.cs#L259

Do I misunderstand this code? I think that this condition should be replaced by

 if (sendHeartBeat && !m_NetworkChannelHelper.SendHeartBeat()) 

After I have successfully sent a heartbeat, it shouldn't report missing a heartbeat.

alexddhuang commented 5 years ago

Could you please actively resolve questions from users? Thanks. @EllanJiang

EllanJiang commented 5 years ago

The counter will increment when a heart beat is sent successfully rather than the opposite. When the response from server is received, the counter will reset. So when the sending counter exceeds some number, it means the we keeps failing to receive server responses.