Differences From Artifact [03983c4b06]:
- File src/resolver.m — part of check-in [dfd8e14567] at 2014-01-29 09:54:56 on branch trunk — resolver.h: Rename private to private_ for C++ (user: js, size: 7393) [annotate] [blame] [check-ins using]
To Artifact [5111ebd364]:
- File
src/resolver.m
— part of check-in
[fb590316ba]
at
2014-01-30 12:26:12
on branch trunk
— Rename +[UDPSocket hostForAddress:port:]
It is now called +[getHost:andPort:forAddress:]. This makes it much
clearer from the selector alone what it actually does. (user: js, size: 7491) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
205 206 207 208 209 210 211 | @throw [OFUnlockFailedException exception]; # endif #endif return ret; } | | | | | > > > < < < | > | < > | | 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | @throw [OFUnlockFailedException exception]; # endif #endif return ret; } void of_address_to_string_and_port(struct sockaddr *address, socklen_t addressLength, OFString *__autoreleasing *host, uint16_t *port) { #ifdef HAVE_THREADSAFE_GETADDRINFO char hostCString[NI_MAXHOST]; char portCString[NI_MAXSERV]; /* FIXME: Add NI_DGRAM for UDP? */ if (getnameinfo(address, addressLength, hostCString, NI_MAXHOST, portCString, NI_MAXSERV, NI_NUMERICHOST | NI_NUMERICSERV)) @throw [OFAddressTranslationFailedException exception]; if (host != NULL) *host = [OFString stringWithUTF8String: hostCString]; if (port != NULL) { char *endptr; long tmp; if ((tmp = strtol(portCString, &endptr, 10)) > UINT16_MAX) @throw [OFOutOfRangeException exception]; if (endptr != NULL && *endptr != '\0') @throw [OFAddressTranslationFailedException exception]; *port = (uint16_t)tmp; } #else char *hostCString; if (address->sa_family != AF_INET) @throw [OFInvalidArgumentException exception]; # if OF_HAVE_THREADS if (!of_mutex_lock(&mutex)) @throw [OFLockFailedException exception]; # endif if ((hostCString = inet_ntoa( ((struct sockaddr_in*)(void*)address)->sin_addr)) == NULL) @throw [OFAddressTranslationFailedException exception]; if (host != NULL) *host = [OFString stringWithUTF8String: hostCString]; if (port != NULL) *port = OF_BSWAP16_IF_LE( ((struct sockaddr_in*)(void*)address)->sin_port); # if OF_HAVE_THREADS if (!of_mutex_unlock(&mutex)) |
︙ | ︙ |