Commit c2f7c907 authored by Flavio Santes's avatar Flavio Santes Committed by Jukka Rissanen
Browse files

iot/dns: Update sample client application



This commit updates the dns client application to use the
new kernel API.

Change-Id: Ibf920532b02a1561bfb38f69e5dd994ab21574bc
Signed-off-by: default avatarFlavio Santes <flavio.santes@intel.com>
parent 3eaec41a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -30,6 +30,6 @@
#define MY_PORT			0
#define PEER_PORT		5353

#define APP_SLEEP_TICKS		500
#define APP_SLEEP_MSECS		200

#endif
+6 −5
Original line number Diff line number Diff line
@@ -129,11 +129,11 @@ void run_dns(void)
#ifdef CONFIG_NET_IPV6
		rc = dns6_resolve(ctx, addresses, &items, ARRAY_SIZE(addresses),
				  domains[d], (struct sockaddr *)&remote_sock,
				  APP_SLEEP_TICKS);
				  APP_SLEEP_MSECS);
#else
		rc = dns4_resolve(ctx, addresses, &items, ARRAY_SIZE(addresses),
				  domains[d], (struct sockaddr *)&remote_sock,
				  APP_SLEEP_TICKS);
				  APP_SLEEP_MSECS);
#endif
		if (rc != 0) {
			printk("rc: %d\n", rc);
@@ -151,7 +151,7 @@ void run_dns(void)
			printk("[%s:%d] %s\n", __func__, __LINE__, str);
		}

		fiber_sleep(APP_SLEEP_TICKS);
		k_sleep(APP_SLEEP_MSECS);
	}

lb_exit:
@@ -163,6 +163,7 @@ lb_exit:
void main(void)
{
	dns_init();
	task_fiber_start(stack, STACK_SIZE, (nano_fiber_entry_t)run_dns,
			 0, 0, 7, 0);

	k_thread_spawn(stack, STACK_SIZE, (k_thread_entry_t)run_dns,
		       NULL, NULL, NULL, K_PRIO_COOP(7), 0, 0);
}