DCPOMATIC_ASSERT (_drive->GetSelection() != wxNOT_FOUND);
DCPOMATIC_ASSERT (static_cast<bool>(_dcp_path));
- bool have_writer = true;
- if (!_nanomsg.send(DISK_WRITER_PING "\n", 2000)) {
- have_writer = false;
- } else {
- auto reply = _nanomsg.receive (2000);
- if (!reply || *reply != DISK_WRITER_PONG) {
- have_writer = false;
+ auto ping = [this](int attempt) {
+ if (_nanomsg.send(DISK_WRITER_PING "\n", 1000)) {
+ auto reply = _nanomsg.receive (1000);
+ if (reply && *reply == DISK_WRITER_PONG) {
+ return true;
+ } else if (reply) {
+ LOG_DISK("Unexpected response %1 to ping received (attempt %2)", *reply, attempt);
+ } else {
+ LOG_DISK("No reply received from ping (attempt %1)", attempt);
+ }
+ } else {
+ LOG_DISK("Could not send ping to writer (attempt %1)", attempt);
+ }
+ dcpomatic_sleep_seconds (1);
+ return false;
+ };
+
+ bool have_writer = false;
+ for (int i = 0; i < 8; ++i) {
+ if (ping(i + 1)) {
+ have_writer = true;
+ break;
}
}
if (!have_writer) {
-#ifdef DCPOMATIC_WINDOWS
+#if defined(DCPOMATIC_WINDOWS)
auto m = new MessageDialog (
this,
_("DCP-o-matic Disk Writer"),
m->ShowModal ();
m->Destroy ();
return;
+#elif defined(DCPOMATIC_OSX)
+ auto m = new MessageDialog (
+ this,
+ _("DCP-o-matic Disk Writer"),
+ _("Did you install the DCP-o-matic Disk Writer.pkg from the .dmg? Please check and try again.")
+ );
+ m->ShowModal ();
+ m->Destroy ();
+ return;
#else
+ LOG_DISK_NC ("Failed to ping writer");
throw CommunicationFailedError ();
#endif
}
LOG_DISK("Sending unmount request to disk writer for %1", drive.as_xml());
if (!_nanomsg.send(DISK_WRITER_UNMOUNT "\n", 2000)) {
+ LOG_DISK_NC("Failed to send unmount request.");
throw CommunicationFailedError ();
}
if (!_nanomsg.send(drive.as_xml(), 2000)) {
+ LOG_DISK_NC("Failed to send drive for unmount request.");
throw CommunicationFailedError ();
}
- auto reply = _nanomsg.receive (2000);
+ /* The reply may have to wait for the user to authenticate, so let's wait a while */
+ auto reply = _nanomsg.receive (30000);
if (!reply || *reply != DISK_WRITER_OK) {
auto * m = new MessageDialog (
this,