changes to socket callback functions were not thread safe. (cherry picked from commit 89c534d3b9)
89c534d3b9