python: Don't rely on id() being unique

Also not using id(socket) avoids a race condition between socket closing
due to socket send error and socket receive error.
c: Fix callback dispatch stopping on disconnect

Callbacks could still get dispatched while the socket was already closed.
This resulted in a guaranteed timeout exception for getters called from
callback functions.

Use an additional lock to serialize disconnection and callback dispatch.
c: Fix race condition in socket closing on socket receive error

Avoid closing the wrong socket, if the disconnect callback is delayed
and a new socket has been opened in the meantime.
python: Reorder IPConnection.handle_disconnect_by_peer signature
c: Handle socket error on send
java: Split callback dispatch into multiple functions
java: Remove ByteBuffer packing for IP Connection meta callbacks
c: Rename Meta id to function_id