CylonSB / bounded-planet

Test Game Please Ignore
6 stars 1 forks source link

Improved networking #48

Closed martindevans closed 3 years ago

martindevans commented 3 years ago

A fairly large refactor of the networking system to make things neater. Almost all of the old free functions have been moved into impl blocks for a struct containing some relevant data. The old BoundedPlanetSendStream/BoundedPlanetReceiveStream wrappers are gone, replaced by Packet::send/Packet::receive methods.

Added a new SendEvent::TransferPacket variant. This is intended for very large data transfers which should not block sending of other packets. The sequence for this is:

  1. Opens a new stream
  2. Spans a new async task
  3. Sends the packet on the new stream (in the async task)
  4. Closes the stream