- } else if (s == DISK_WRITER_ERROR) {
- string const m = _nanomsg.blocking_get ();
- string const n = _nanomsg.blocking_get ();
- throw CopyError (m, raw_convert<int>(n));
- } else if (s == DISK_WRITER_FORMATTING) {
- sub ("Formatting drive");
- set_progress_unknown ();
- formatting = true;
- } else if (s == DISK_WRITER_PROGRESS) {
- if (formatting) {
- sub ("Copying DCP");
- formatting = false;
+ } else if (*s == DISK_WRITER_ERROR) {
+ auto const m = _nanomsg.receive (500);
+ auto const n = _nanomsg.receive (500);
+ throw CopyError (m.get_value_or("Unknown"), raw_convert<int>(n.get_value_or("0")));
+ } else if (*s == DISK_WRITER_FORMAT_PROGRESS) {
+ if (state == SETUP) {
+ sub (_("Formatting drive"));
+ state = FORMAT;
+ }
+ auto progress = _nanomsg.receive (500);
+ if (progress) {
+ set_progress (raw_convert<float>(*progress));
+ }
+ } else if (*s == DISK_WRITER_COPY_PROGRESS) {
+ if (state == FORMAT) {
+ sub (_("Copying DCP"));
+ state = COPY;
+ }
+ auto progress = _nanomsg.receive (500);
+ if (progress) {
+ set_progress (raw_convert<float>(*progress));
+ }
+ } else if (*s == DISK_WRITER_VERIFY_PROGRESS) {
+ if (state == COPY) {
+ sub (_("Verifying copied files"));
+ state = VERIFY;
+ }
+ auto progress = _nanomsg.receive (500);
+ if (progress) {
+ set_progress (raw_convert<float>(*progress));