From: ChaJiWon Date: Wed, 12 Apr 2017 12:12:46 +0000 (+0900) Subject: Modified getNetAddress() in SceneUtils X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0b1a8bce125e4543e40c4b855a64384fe7ef5865;p=contrib%2Fiotivity.git Modified getNetAddress() in SceneUtils If network have IPv4 address, it returns IPv4 address. Change-Id: Iba93339b6a980251194b02d6fa905006a88a0608 Signed-off-by: ChaJiWon Reviewed-on: https://gerrit.iotivity.org/gerrit/18675 Reviewed-by: Uze Choi Reviewed-by: JungYong KIM Tested-by: jenkins-iotivity --- diff --git a/service/scene-manager/src/SceneUtils.cpp b/service/scene-manager/src/SceneUtils.cpp index 7face9f..0b244a0 100755 --- a/service/scene-manager/src/SceneUtils.cpp +++ b/service/scene-manager/src/SceneUtils.cpp @@ -93,7 +93,8 @@ namespace OIC { address_ipv4 = std::string(netInfo[i].addr) + ":" + std::to_string(netInfo[i].port); - } else if(netInfo[i].flags == CATransportFlags_t::CA_IPV6) + } + else if(netInfo[i].flags == CATransportFlags_t::CA_IPV6) { char addressEncoded[CA_MAX_URI_LENGTH] = {0}; @@ -111,12 +112,14 @@ namespace OIC } } } - - if(address_ipv4.length() > 0 && address_ipv6.length() == 0) + // currently ipv6 case doesn't work due to create remote resource object api fail on v6. + // Even if both ipv4 & ipv6 are in the netinfo, ipv4 address will be returned as below. + // if create remote resource object api work well on IPv6 later, below should be fixed. + if (!address_ipv4.empty()) { OICFree(netInfo); return address_ipv4; - } else if(address_ipv6.length() > 0) + } else if (!address_ipv6.empty()) { OICFree(netInfo); return address_ipv6;