summaryrefslogtreecommitdiff
path: root/backend/net.c
diff options
context:
space:
mode:
Diffstat (limited to 'backend/net.c')
-rw-r--r--backend/net.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/backend/net.c b/backend/net.c
index 16fba2f..4beb45d 100644
--- a/backend/net.c
+++ b/backend/net.c
@@ -140,7 +140,7 @@ static int hang_over;
client/server have different endianness. A value of -1 means, that there's
no left over; otherwise the value has to be casted to SANE_Byte. left_over
means, that there is a remaining byte from a previous call to sane_read,
- which already is in the the correct byte order, but could not be returned,
+ which already is in the correct byte order, but could not be returned,
e.g. because the frontend requested only one byte per call.
*/
static int left_over;
@@ -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");