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 <senthil.gs@samsung.com>
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
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))
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:
if target_os in targets_disallow_multitransport:
help_vars.Add(ListVariable('TARGET_TRANSPORT', 'Target transport', 'IP', ['BT', 'BLE', 'IP', 'NFC']))
else:
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(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',
AddOption('--prefix',
dest='prefix',
type='string',
if env.get('WITH_PROCESS_EVENT'):
env.AppendUnique(CPPDEFINES=['WITH_PROCESS_EVENT'])
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')
libs = []
if env.get('SECURED') == '1':
defines.append('-D__WITH_DTLS__=1')
NS_LOG_V(INFO_PRIVATE, "remote_address : %s:%d", info->addr, info->port);
NS_LOG_V(DEBUG, "isConnect : %d", 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)
NSTaskType type = TASK_EVENT_CONNECTED;
OCDevAddr * addr = NULL;
if (connected)