Conversation
|
Can you please add a test? |
|
Actually, put this on hold, it's probably a good idea to pass the packet to the callback function. That way, it can use the |
|
What's the point of the userdata field? Is it just so you keep a python reference count? Also, is it necessary to keep a function pointer for each packet? Why not just define one callback function on the host for on packet free? |
The userData field is provided by enet (on a number of structs) and common to use with callback systems to allow "passing" data to the callback function. As we can not call python functions directly from C, the userData we pass is a pointer to the python callable we want to be called. The way I did things here is inspired by cython's callback example: https://github.com/cython/cython/tree/master/Demos/callback
The python object is converted into a
|
This allows you to get notified when enet is done with the packet, i.e. it has been transmitted successfully.