p2p: Change p2p_register to look for service name
authorOlivier Guiter <olivier.guiter@linux.intel.com>
Tue, 27 Aug 2013 14:56:21 +0000 (16:56 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Wed, 28 Aug 2013 09:02:29 +0000 (11:02 +0200)
On p2p driver registration, the search is now done with the
service name (instead of the driver name).

plugins/p2p.c

index 5191926..a3904a7 100644 (file)
@@ -610,12 +610,15 @@ int near_p2p_register(struct near_p2p_driver *driver)
        struct near_p2p_driver *tmp_driver;
        GSList *list = NULL;
 
-       DBG("driver %p name %s", driver, driver->name);
+       DBG("driver %p name %s service %s", driver, driver->name,
+                       driver->service_name);
 
        for (list = driver_list; list; list = list->next) {
                tmp_driver = list->data;
-               if (g_strcmp0(tmp_driver->name, driver->name) == 0) {
-                       near_error("%s already registered", driver->name);
+               if (g_strcmp0(tmp_driver->service_name,
+                                               driver->service_name) == 0) {
+                       near_error("%s already registered",
+                                                       driver->service_name);
                        return -EALREADY;
                }
        }
@@ -626,7 +629,7 @@ int near_p2p_register(struct near_p2p_driver *driver)
 
 void near_p2p_unregister(struct near_p2p_driver *driver)
 {
-       DBG("driver %p name %s", driver, driver->name);
+       DBG("driver %p name %s", driver, driver->service_name);
 
        driver_list = g_slist_remove(driver_list, driver);
 }