Because we (finally) have C++11, there is no excuse for using ints/flags/anything concurrently.
#9695 (which this is based on) got most of them, but the last two (addrName and addrLocal) were left out because they might need more discussion. Here I opted for giving them a wrapper which does locked access, though that does mean creating copies of them during use.