kopia lustrzana https://gitlab.com/sane-project/backends
net: Add mutex lock logic around device additions
The avahi_thread may call add_device() as well. This addresses a concern raised in 313921 and may fix 314696 as well as 315044.merge-requests/1/head
rodzic
f219f7fbd8
commit
219a877858
|
@ -1044,9 +1044,14 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
|
|||
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef WITH_AVAHI
|
||||
avahi_threaded_poll_lock (avahi_thread);
|
||||
#endif /* WITH_AVAHI */
|
||||
DBG (2, "sane_init: trying to add %s\n", device_name);
|
||||
add_device (device_name, 0);
|
||||
#ifdef WITH_AVAHI
|
||||
avahi_threaded_poll_unlock (avahi_thread);
|
||||
#endif /* WITH_AVAHI */
|
||||
}
|
||||
|
||||
fclose (fp);
|
||||
|
@ -1090,8 +1095,14 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
|
|||
if (host[0] == '\0')
|
||||
continue;
|
||||
#endif /* ENABLE_IPV6 */
|
||||
#ifdef WITH_AVAHI
|
||||
avahi_threaded_poll_lock (avahi_thread);
|
||||
#endif /* WITH_AVAHI */
|
||||
DBG (2, "sane_init: trying to add %s\n", host);
|
||||
add_device (host, 0);
|
||||
#ifdef WITH_AVAHI
|
||||
avahi_threaded_poll_unlock (avahi_thread);
|
||||
#endif /* WITH_AVAHI */
|
||||
}
|
||||
free (copy);
|
||||
}
|
||||
|
@ -1507,7 +1518,13 @@ sane_open (SANE_String_Const full_name, SANE_Handle * meta_handle)
|
|||
DBG (1,
|
||||
"sane_open: device %s not found, trying to register it anyway\n",
|
||||
nd_name);
|
||||
#ifdef WITH_AVAHI
|
||||
avahi_threaded_poll_lock (avahi_thread);
|
||||
#endif /* WITH_AVAHI */
|
||||
status = add_device (nd_name, &dev);
|
||||
#ifdef WITH_AVAHI
|
||||
avahi_threaded_poll_unlock (avahi_thread);
|
||||
#endif /* WITH_AVAHI */
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
DBG (1, "sane_open: could not open device\n");
|
||||
|
|
Ładowanie…
Reference in New Issue