From: Senthil Kumar G S Date: Mon, 22 Apr 2019 13:18:54 +0000 (+0530) Subject: Disable auto-discovery of NSProvider over TCP. X-Git-Tag: accepted/tizen/unified/20190429.103659~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;ds=sidebyside;h=e2b3a3137f295083c45c09fdea3cfb4672b6f5b9;p=platform%2Fupstream%2Fiotivity.git Disable auto-discovery of NSProvider over TCP. For disabling auto-discovery, DISABLE_AUTO_TCP_NSPROVIDER_DISCOVERY flag should be set to 1 in scons build command. Background:- For TCP Connected events, NS Consumer automatically discovers initiates the discovery of NS Provider. Due to which, there is a problem which occurs when app perform sign-in and there is no TCP connection, then connection will be established first. NS Consumer will then receive the TCP connected event and initiate NS Provider discovery. Even before sign-in, upon receiving the NS Provider discovery closes the connection as it is in the process of sign-in. This patch addresses the problem by disabling auto-discovery of NSProvider over TCP for TCP connected events. As auto discovery is disabled, application should explicitly perform discovery by calling "NSConsumerEnableRemoteService" API (strictly after sign-in). https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/488 (cherry picked from 8edd5e6a62a3d3892871efc9f4fb1f7f4b32fd9b) Change-Id: I41910070ad8c60c64aa8fa4567f98d98690965a4 Signed-off-by: Senthil Kumar G S Signed-off-by: DoHyun Pyun --- diff --git a/build_common/SConscript b/build_common/SConscript index c351abe..577cbff 100755 --- a/build_common/SConscript +++ b/build_common/SConscript @@ -109,7 +109,6 @@ help_vars.Add(BoolVariable('SIMULATOR', 'Build with simulator module', False)) help_vars.Add(BoolVariable('WITH_RA_IBB', 'Build with Remote Access module(workssys)', False)) help_vars.Add(BoolVariable('WITH_ASAN', 'Build with Address Sanitizer support', False)) - if target_os in targets_disallow_multitransport: help_vars.Add(ListVariable('TARGET_TRANSPORT', 'Target transport', 'IP', ['BT', 'BLE', 'IP', 'NFC'])) else: @@ -139,6 +138,7 @@ help_vars.Add(PathVariable('TIZENRT_OS_DIR', 'Absolute Path to TizenRT OS direct help_vars.Add(EnumVariable('PLATFORM_TLS', 'Use platform tls instead of local mbedtls', '0', allowed_values=('0', '1'))) help_vars.Add(EnumVariable('OIC_SUPPORT_TIZEN_TRACE', 'Tizen Trace(T-trace) api availability', 'False', allowed_values=('True', 'False'))) help_vars.Add(BoolVariable('WITH_PROCESS_EVENT','Build including process event logics in ocstack', 'False')) +help_vars.Add(BoolVariable('DISABLE_AUTO_TCP_NSPROVIDER_DISCOVERY', 'Disable auto-discovery of NSProvider over TCP for TCP connected events', False)) AddOption('--prefix', dest='prefix', type='string', @@ -370,6 +370,9 @@ if env.get('DISABLE_BLE_SERVER'): if env.get('WITH_PROCESS_EVENT'): env.AppendUnique(CPPDEFINES=['WITH_PROCESS_EVENT']) +if env.get('DISABLE_AUTO_TCP_NSPROVIDER_DISCOVERY'): + env.AppendUnique(CPPDEFINES = ['DISABLE_AUTO_TCP_NSPROVIDER_DISCOVERY']) + libs = [] if env.get('SECURED') == '1': defines.append('-D__WITH_DTLS__=1') diff --git a/service/notification/src/consumer/NSConsumerNetworkEventListener.c b/service/notification/src/consumer/NSConsumerNetworkEventListener.c index 21881b1..078b6a5 100644 --- a/service/notification/src/consumer/NSConsumerNetworkEventListener.c +++ b/service/notification/src/consumer/NSConsumerNetworkEventListener.c @@ -84,6 +84,14 @@ void NSConnectionStateListener(const CAEndpoint_t * info, bool connected) NS_LOG_V(INFO_PRIVATE, "remote_address : %s:%d", info->addr, info->port); NS_LOG_V(DEBUG, "isConnect : %d", connected); +#ifdef DISABLE_AUTO_TCP_NSPROVIDER_DISCOVERY + if (info->adapter == CA_ADAPTER_TCP) + { + NS_LOG(DEBUG, "Ignoring the TCP event."); + return; + } +#endif + NSTaskType type = TASK_EVENT_CONNECTED; OCDevAddr * addr = NULL; if (connected)