- g_source_set_priority(nl->source, priority);
-
- memset(&nl->poll_fd, 0, sizeof(GPollFD));
- nl->poll_fd.fd = fd;
- nl->poll_fd.events = G_IO_IN|G_IO_ERR|G_IO_HUP;
- g_source_add_poll(nl->source, &nl->poll_fd);
-
- g_source_attach(nl->source, nl->context);
+ if (!(nl->watch = poll_api->watch_new(poll_api, fd, AVAHI_WATCH_IN, socket_event, nl))) {
+ avahi_log_error(__FILE__": Failed to create watch.");
+ goto fail;
+ }