+ xfer_queue_message(elt->xfer, xmsg_new(elt, XMSG_DONE, 0));
+
+ return NULL;
+}
+
+static gpointer
+directtcp_connect_thread(
+ gpointer data)
+{
+ XferSourceRecovery *self = XFER_SOURCE_RECOVERY(data);
+ XferElement *elt = XFER_ELEMENT(self);
+
+ DBG(1, "(this is directtcp_connect_thread)")
+
+ /* first, we need to accept the incoming connection; we do this while
+ * holding the start_part_mutex, so that a part doesn't get started until
+ * we're finished with the device */
+ g_mutex_lock(self->start_part_mutex);
+
+ if (elt->cancelled) {
+ g_mutex_unlock(self->start_part_mutex);
+ goto send_done;
+ }
+
+ g_assert(self->device != NULL); /* have a device */
+ g_assert(elt->output_listen_addrs != NULL); /* listening on it */
+ g_assert(self->listen_ok);
+
+ DBG(2, "accepting DirectTCP connection on device %s", self->device->device_name);
+ if (!device_accept(self->device, &self->conn, NULL, NULL)) {
+ xfer_cancel_with_error(elt,
+ _("error accepting DirectTCP connection: %s"),
+ device_error_or_status(self->device));
+ g_mutex_unlock(self->start_part_mutex);
+ wait_until_xfer_cancelled(elt->xfer);
+ goto send_done;
+ }
+ DBG(2, "DirectTCP connection accepted");
+
+ return directtcp_common_thread(self);
+