Closed luked99 closed 6 years ago
I don't like this global/threadlocal state but since it's already there and this PR only improves upon it, I'm gonna accept it.
If there's a better way, I could have a go at putting something together.
Could pass in some state to use - we're already passing in a boolean to say if it's client or server.
Or perhaps there's a way to attach some state to the socket.
readData() uses the global reqPing, but that's not allowed for an .async. function.
Follow the pattern in the asyncnet example, where the global state becomes thread-local.
Fixes #20.