Add missing lock around the use of gethostbyaddr.

This cures the symptoms of ROOT-6828 ... however this will fails if any other code anywhere else also
uses gethostbyaddr .. the right solution is to replace the use of gethostbyaddr by getaddrinfo

(cherry picked from commit d22fcb4f7ce49ea788a8591e6aac495d26750e9f)