+ fd = jcr->file_bsock;
+ }
+
+ set_jcr_job_status(jcr, JS_WaitSD);
+
+ /*
+ * Send the bootstrap file -- what Volumes/files to restore
+ */
+ if (!send_bootstrap_file(jcr, sd, info) ||
+ !response(jcr, sd, OKbootstrap, "Bootstrap", DISPLAY_ERROR)) {
+ goto bail_out;
+ }
+
+ if (!sd->fsend("run")) {
+ goto bail_out;
+ }
+ /*
+ * Now start a Storage daemon message thread
+ */
+ if (!start_storage_daemon_message_thread(jcr)) {
+ goto bail_out;
+ }
+ Dmsg0(50, "Storage daemon connection OK\n");
+
+ /*
+ * send Storage daemon address to the File daemon,
+ * then wait for File daemon to make connection
+ * with Storage daemon.
+ */
+ if (jcr->rstore->SDDport == 0) {
+ jcr->rstore->SDDport = jcr->rstore->SDport;
+ }
+ fd->fsend(storaddr, jcr->rstore->address, jcr->rstore->SDDport,
+ jcr->sd_auth_key);
+ memset(jcr->sd_auth_key, 0, strlen(jcr->sd_auth_key));
+
+ Dmsg1(6, "dird>filed: %s\n", fd->msg);
+ if (!response(jcr, fd, OKstore, "Storage", DISPLAY_ERROR)) {
+ goto bail_out;
+ }
+
+ if (first_time) {
+ if (!send_runscripts_commands(jcr)) {
+ goto bail_out;
+ }
+ first_time=false;
+ }
+
+ fd->fsend("%s", restore_cmd.c_str());
+
+ if (!response(jcr, fd, OKrestore, "Restore", DISPLAY_ERROR)) {
+ goto bail_out;
+ }
+
+ if (jcr->FDVersion < 2) { /* Old FD */
+ end_loop=true; /* we do only one loop */
+
+ } else {
+ if (!response(jcr, fd, OKstoreend, "Store end", DISPLAY_ERROR)) {
+ goto bail_out;
+ }
+ wait_for_storage_daemon_termination(jcr);
+ }
+ } /* the whole boostrap has been send */
+
+ if (fd && jcr->FDVersion >= 2) {
+ fd->fsend("endrestore");