[gupnp-tools] universal-cp: Avoid find_device() recursion when possible



commit 71d4f41c152b2cdc1d551fcf7a17c406ff79bfc1
Author: Jussi Kukkonen <jussi kukkonen intel com>
Date:   Tue Jan 28 16:44:24 2014 +0200

    universal-cp: Avoid find_device() recursion when possible
    
    This should limit the massive processor usage in busy networks, as
    the old implementation recursed into every service, state variable
    and method. This patch only recurses into sub-devices.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=723172

 src/universal-cp/device-treeview.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/src/universal-cp/device-treeview.c b/src/universal-cp/device-treeview.c
index 8a8af8e..5e08c01 100644
--- a/src/universal-cp/device-treeview.c
+++ b/src/universal-cp/device-treeview.c
@@ -94,16 +94,18 @@ find_device (GtkTreeModel *model,
                         }
 
                         g_object_unref (info);
-                }
 
-                if (found)
-                        break;
+                        if (found)
+                                break;
 
-                /* recurse into embedded-devices */
-                found = find_device (model, udn, iter, &tmp);
-                if (found) {
-                        *iter = tmp;
-                        break;
+                        if (icon_type == ICON_DEVICE) {
+                                /* recurse into embedded-devices */
+                                found = find_device (model, udn, iter, &tmp);
+                                if (found) {
+                                        *iter = tmp;
+                                        break;
+                                }
+                        }
                 }
 
                 more = gtk_tree_model_iter_next (model, iter);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]