Add timestamps to the 'SSH raw data' logging mode.
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Wed, 10 Oct 2012 18:32:23 +0000 (18:32 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Wed, 10 Oct 2012 18:32:23 +0000 (18:32 +0000)
git-svn-id: svn://svn.tartarus.org/sgt/putty@9687 cda61777-01e9-0310-a592-d414129be87e

logging.c

index 6252364..fc89db7 100644 (file)
--- a/logging.c
+++ b/logging.c
@@ -258,8 +258,21 @@ void log_packet(void *handle, int direction, int type,
                      type, type, texttype);
        }
     } else {
-        logprintf(ctx, "%s raw data\r\n",
-                  direction == PKT_INCOMING ? "Incoming" : "Outgoing");
+        /*
+         * Raw data is logged with a timestamp, so that it's possible
+         * to determine whether a mysterious delay occurred at the
+         * client or server end. (Timestamping the raw data avoids
+         * cluttering the normal case of only logging decrypted SSH
+         * messages, and also adds conceptual rigour in the case where
+         * an SSH message arrives in several pieces.)
+         */
+        char buf[256];
+        struct tm tm;
+       tm = ltime();
+       strftime(buf, 24, "%Y-%m-%d %H:%M:%S", &tm);
+        logprintf(ctx, "%s raw data at %s\r\n",
+                  direction == PKT_INCOMING ? "Incoming" : "Outgoing",
+                  buf);
     }
 
     /*