-
Notifications
You must be signed in to change notification settings - Fork 2
Networking fixes #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Networking fixes #36
Conversation
LeeVangraefschepe
commented
Dec 2, 2023
- Only the basepacket function got called when setting data for a packet.
- Client no longer needs ticks. The receive call is blocking and doesnt spam the thread.
- Changed error to warning when connection
Only the basepacket function got called when setting data for the packet.
Client no longer needs ticks. The receive call is blocking and doesnt spam the thread.
| void leap::networking::LeapClient::HandleReceiveUDP() | ||
| { | ||
| // Receive a response from the server | ||
| std::vector<char> buffer{}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems very unefficient because you create a new vector of, in this case, 1024 bytes everytime a new message is being received. 1kB per message on UDP seems a lot of allocations/deallocations. Maybe move the buffer to the UDPRun function and give a reference to the HandleReceiveUDP function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This vector is moved to the packet. But there is an option to pool these buffers to decrease the usage of allocations & deallocations.
The client code now reuses the buffer for the incoming packets. (copy is still made for the package itself)
Error messages are made more clear