|
@@ -27,11 +27,17 @@ static int lssdp_service_register(struct lssdp_service *h)
|
|
|
|
|
|
|
|
if (h == RT_NULL)
|
|
if (h == RT_NULL)
|
|
|
return -RT_ERROR;
|
|
return -RT_ERROR;
|
|
|
|
|
+
|
|
|
|
|
+ /* enter interrupt */
|
|
|
|
|
+ rt_interrupt_enter();
|
|
|
|
|
|
|
|
rt_slist_for_each(head, &_lssdp_list)
|
|
rt_slist_for_each(head, &_lssdp_list)
|
|
|
{
|
|
{
|
|
|
if (rt_strcmp(h->name, ((lssdp_service_t)head)->name) == 0)
|
|
if (rt_strcmp(h->name, ((lssdp_service_t)head)->name) == 0)
|
|
|
{
|
|
{
|
|
|
|
|
+ /* leave interrupt */
|
|
|
|
|
+ rt_interrupt_leave();
|
|
|
|
|
+
|
|
|
LOG_E("service %s is already exists!", h->name );
|
|
LOG_E("service %s is already exists!", h->name );
|
|
|
return -RT_ERROR;
|
|
return -RT_ERROR;
|
|
|
}
|
|
}
|
|
@@ -39,6 +45,9 @@ static int lssdp_service_register(struct lssdp_service *h)
|
|
|
|
|
|
|
|
rt_slist_init(&h->list);
|
|
rt_slist_init(&h->list);
|
|
|
rt_slist_append(&_lssdp_list, &h->list);
|
|
rt_slist_append(&_lssdp_list, &h->list);
|
|
|
|
|
+
|
|
|
|
|
+ /* leave interrupt */
|
|
|
|
|
+ rt_interrupt_leave();
|
|
|
|
|
|
|
|
return RT_EOK;
|
|
return RT_EOK;
|
|
|
}
|
|
}
|
|
@@ -50,16 +59,26 @@ static int lssdp_service_unregister(struct lssdp_service *h)
|
|
|
|
|
|
|
|
if (h == RT_NULL)
|
|
if (h == RT_NULL)
|
|
|
return -RT_ERROR;
|
|
return -RT_ERROR;
|
|
|
|
|
+
|
|
|
|
|
+ /* enter interrupt */
|
|
|
|
|
+ rt_interrupt_enter();
|
|
|
|
|
|
|
|
rt_slist_for_each(head, &_lssdp_list)
|
|
rt_slist_for_each(head, &_lssdp_list)
|
|
|
{
|
|
{
|
|
|
if (rt_strcmp(h->name, ((lssdp_service_t)head)->name) == 0)
|
|
if (rt_strcmp(h->name, ((lssdp_service_t)head)->name) == 0)
|
|
|
{
|
|
{
|
|
|
rt_slist_remove(&_lssdp_list, head);
|
|
rt_slist_remove(&_lssdp_list, head);
|
|
|
|
|
+
|
|
|
|
|
+ /* leave interrupt */
|
|
|
|
|
+ rt_interrupt_leave();
|
|
|
|
|
+
|
|
|
rt_free(head);
|
|
rt_free(head);
|
|
|
return RT_EOK;
|
|
return RT_EOK;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /* leave interrupt */
|
|
|
|
|
+ rt_interrupt_leave();
|
|
|
|
|
|
|
|
LOG_E("Can't find service name %s to unregister", h->name);
|
|
LOG_E("Can't find service name %s to unregister", h->name);
|
|
|
|
|
|