/*
- * Copyright 2015 Facebook, Inc.
+ * Copyright 2016 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
}
}
-void SocketAddress::setFromPeerAddress(int socket) {
+void SocketAddress::setFromPeerAddress(SocketDesc socket) {
setFromSocket(socket, getpeername);
}
-void SocketAddress::setFromLocalAddress(int socket) {
+void SocketAddress::setFromLocalAddress(SocketDesc socket) {
setFromSocket(socket, getsockname);
}
setFromSockaddr(info->ai_addr, info->ai_addrlen);
}
-void SocketAddress::setFromSocket(int socket,
- int (*fn)(int, sockaddr*, socklen_t*)) {
+void SocketAddress::setFromSocket(SocketDesc socket, GetPeerNameFunc fn) {
// Try to put the address into a local storage buffer.
sockaddr_storage tmp_sock;
socklen_t addrLen = sizeof(tmp_sock);