summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-05-30 14:41:22 +0200
committerCarl Hetherington <cth@carlh.net>2022-06-08 22:20:58 +0200
commit6b966acc4b9078989de82daf742b6569b749d0a0 (patch)
tree46d01a8963678dd05d49ab9cd032f852c170ad32
parente6ebc314597b0e52ebfdbc7190d847adc5c6adcb (diff)
Fix a few places where a complete ERROR message was not being sent.
-rw-r--r--src/tools/dcpomatic_disk_writer.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/tools/dcpomatic_disk_writer.cc b/src/tools/dcpomatic_disk_writer.cc
index cfb610f0a..dca09f729 100644
--- a/src/tools/dcpomatic_disk_writer.cc
+++ b/src/tools/dcpomatic_disk_writer.cc
@@ -177,13 +177,19 @@ try
"com.dcpomatic.write-drive",
[xml]() {
bool const success = Drive(xml).unmount();
- if (!nanomsg->send(success ? (DISK_WRITER_OK "\n") : (DISK_WRITER_ERROR "\n"), LONG_TIMEOUT)) {
+ bool sent_reply = false;
+ if (success) {
+ sent_reply = nanomsg->send(DISK_WRITER_OK "\n", LONG_TIMEOUT);
+ } else {
+ sent_reply = nanomsg->send(DISK_WRITER_ERROR "\nCould not unmount drive\n1\n", LONG_TIMEOUT);
+ }
+ if (!sent_reply) {
LOG_DISK_NC("CommunicationFailedError in unmount_finished");
throw CommunicationFailedError ();
}
},
[]() {
- if (!nanomsg->send(DISK_WRITER_ERROR "\n", LONG_TIMEOUT)) {
+ if (!nanomsg->send(DISK_WRITER_ERROR "\nCould not get permission to unmount drive\n1\n", LONG_TIMEOUT)) {
LOG_DISK_NC("CommunicationFailedError in unmount_finished");
throw CommunicationFailedError ();
}
@@ -266,7 +272,7 @@ try
},
[]() {
if (nanomsg) {
- nanomsg->send(DISK_WRITER_ERROR "\nCould not obtain authorization to write to the drive\n", LONG_TIMEOUT);
+ nanomsg->send(DISK_WRITER_ERROR "\nCould not obtain authorization to write to the drive\n1\n", LONG_TIMEOUT);
}
});
}