Move both calls to getpeername into a common wrapper function that