Commit graph

1 commit

Author SHA1 Message Date
Andy Cook
ae0c4e5f87 Expose enet peer data field
Decided to allow storing of arbitrary data saved as a byte slice,
leaving the conversion of whatever data that wants to be stored (e.g. an
identified or JSON) up to the consumer.

Importantly this data is being stored in enet C field so we ensure that
the data is being copied out in to C allocation, rather than allowing C
code to have Go pointers. For this reason, it is up to the caller to
unset data when the peer is done with to avoid memory leaks. I couldn't
find a way with enet to have this automatically cleaned up.
2023-01-24 19:03:22 +01:00