From 1757d6dbc8136c0a31952e2a16cfe4a01f1c2ca0 Mon Sep 17 00:00:00 2001
From: Ramakrishnan Muthukrishnan <ram@rkrishnan.org>
Date: Fri, 28 Oct 2022 14:39:41 +0530
Subject: [PATCH] speed up discovery for radioberry

Do not look at TCP Port, only look at localhost
---
 old_discovery.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/old_discovery.c b/old_discovery.c
index 748b8ab..7f27ee7 100644
--- a/old_discovery.c
+++ b/old_discovery.c
@@ -252,7 +252,7 @@ int stemlab_get_info(int id) {
   int optval,i;
 
   // Allow RP app to come up
-  sleep(2);
+  //sleep(2);
 
   devices=id;
 
@@ -523,8 +523,8 @@ fprintf(stderr,"old_discovery\n");
         g_main_context_iteration(NULL, 0);
         if (ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_INET) {
             if((ifa->ifa_flags&IFF_UP)==IFF_UP
-                && (ifa->ifa_flags&IFF_RUNNING)==IFF_RUNNING) {
-                //&& (ifa->ifa_flags&IFF_LOOPBACK)!=IFF_LOOPBACK) {
+                && (ifa->ifa_flags&IFF_RUNNING)==IFF_RUNNING
+                && (ifa->ifa_flags&IFF_LOOPBACK)==IFF_LOOPBACK) {
                 discover(ifa);
             }
         }
@@ -533,7 +533,7 @@ fprintf(stderr,"old_discovery\n");
     freeifaddrs(addrs);
 
     // Do one additional "discover" for a fixed TCP address
-    discover(NULL);
+    // discover(NULL);
 
     fprintf(stderr, "discovery found %d devices\n",devices);
 
-- 
2.45.2