server/: Introduce accessor functions for reading and writing port numbers.
[tripe] / server / peer.c
index ba8d7ba..ea6e09b 100644 (file)
@@ -830,8 +830,7 @@ unsigned p_port(int i)
 
   if (getsockname(udpsock[i].fd, &a.sa, &sz))
     die(EXIT_FAILURE, "couldn't read port number: %s", strerror(errno));
-  assert(a.sa.sa_family == AF_INET);
-  return (ntohs(a.sin.sin_port));
+  return (getport(&a));
 }
 
 /* --- @p_keepalive@ --- *