@@ -406,25 +406,31 @@ STATUS getIpWithHostName(PCHAR hostname, PKvsIpAddress destIp)
406
406
struct in_addr inaddr ;
407
407
408
408
CHAR addr [KVS_IP_ADDRESS_STRING_BUFFER_LEN + 1 ] = {'\0' };
409
+ BOOL isStunServer ;
409
410
410
411
CHK (hostname != NULL , STATUS_NULL_ARG );
411
412
DLOGI ("ICE SERVER Hostname received: %s" , hostname );
412
413
413
414
hostnameLen = STRLEN (hostname );
414
415
addrLen = SIZEOF (addr );
416
+ isStunServer = STRNCMP (hostname , KINESIS_VIDEO_STUN_URL_PREFIX , KINESIS_VIDEO_STUN_URL_PREFIX_LENGTH ) == 0 ;
415
417
416
418
// Adding this check in case we directly get an IP address. With the current usage pattern,
417
419
// there is no way this function would receive an address directly, but having this check
418
420
// in place anyways
419
421
if (isIpAddr (hostname , hostnameLen )) {
420
422
MEMCPY (addr , hostname , hostnameLen );
421
- } else {
423
+ } else if (! isStunServer ) {
422
424
retStatus = getIpAddrFromDnsHostname (hostname , addr , hostnameLen , addrLen );
423
425
}
424
426
425
427
// Verify the generated address has the format x.x.x.x
426
428
if (!isIpAddr (addr , hostnameLen ) || retStatus != STATUS_SUCCESS ) {
427
- DLOGW ("Parsing for address failed for %s, fallback to getaddrinfo" , hostname );
429
+ // Only print the message for TURN servers since STUN addresses don't have the IP in the URL
430
+ if (!isStunServer ) {
431
+ DLOGW ("Parsing for address failed for %s, fallback to getaddrinfo" , hostname );
432
+ }
433
+
428
434
errCode = getaddrinfo (hostname , NULL , NULL , & res );
429
435
if (errCode != 0 ) {
430
436
errStr = errCode == EAI_SYSTEM ? (strerror (errno )) : ((PCHAR ) gai_strerror (errCode ));
0 commit comments