Skip to content

Conversation

@LeeVangraefschepe
Copy link
Owner

  • 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{};
Copy link
Collaborator

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?

Copy link
Owner Author

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants