fix client join/leave race with master server ping
Merge pull request #4461 from chrisforbes/master-ping-thread-safety

fixes #4459