Add more logging to disk writer.
authorCarl Hetherington <cth@carlh.net>
Sun, 9 May 2021 08:08:39 +0000 (10:08 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 9 May 2021 21:15:05 +0000 (23:15 +0200)
src/lib/copy_to_drive_job.cc
src/lib/nanomsg.cc
src/tools/dcpomatic_disk.cc

index 96f873cf61e75d99ccb659ff544cfb1485191463..9ddedfe62dfc8c946f38a1fd7a65755bf8bccd7d 100644 (file)
@@ -67,6 +67,7 @@ CopyToDriveJob::run ()
 {
        LOG_DISK("Sending write request to disk writer for %1 %2", _dcp.string(), _drive.device());
        if (!_nanomsg.send(String::compose(DISK_WRITER_WRITE "\n%1\n%2\n", _dcp.string(), _drive.device()), 2000)) {
+               LOG_DISK_NC("Failed to send write request.");
                throw CommunicationFailedError ();
        }
 
index b66d966afb7cc4bd02ed5b42142b6f7cc736f9fe..1180f69369930958ba3ad44cef56da5de4f4f70a 100644 (file)
@@ -99,6 +99,7 @@ Nanomsg::recv_and_parse (int flags)
                        return;
                }
 
+               LOG_DISK_NC("nn_recv failed");
                throw CommunicationFailedError ();
        }
 
index a3b351c85fdc5d28ea11d575b5ead69879b0ef5f..0a53a0a9bd02f8ec390267cec1f8c98930ec4958 100644 (file)
@@ -251,10 +251,15 @@ private:
 
                bool have_writer = true;
                if (!_nanomsg.send(DISK_WRITER_PING "\n", 2000)) {
+                       LOG_DISK_NC("Could not send ping to writer");
                        have_writer = false;
                } else {
                        auto reply = _nanomsg.receive (2000);
-                       if (!reply || *reply != DISK_WRITER_PONG) {
+                       if (!reply) {
+                               LOG_DISK_NC("No reply received from ping");
+                               have_writer = false;
+                       } else if (*reply != DISK_WRITER_PONG) {
+                               LOG_DISK_NC("Unexpected response to ping received");
                                have_writer = false;
                        }
                }
@@ -270,6 +275,7 @@ private:
                        m->Destroy ();
                        return;
 #else
+                       LOG_DISK_NC ("Failed to ping writer");
                        throw CommunicationFailedError ();
 #endif
                }
@@ -285,9 +291,11 @@ private:
 
                        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 ();
                        }
                        /* The reply may have to wait for the user to authenticate, so let's wait a while */