]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Flush the logfile reasonably frequently in `printable output only' and
authorJacob Nevins <jacobn@chiark.greenend.org.uk>
Thu, 12 Aug 2004 01:02:01 +0000 (01:02 +0000)
committerJacob Nevins <jacobn@chiark.greenend.org.uk>
Thu, 12 Aug 2004 01:02:01 +0000 (01:02 +0000)
`all session data' modes, without completely mauling the performance, by
fflush()ing once per term_out(). If anyone complains I suppose we can
make this optional.

[originally from svn r4445]

logging.c
putty.h
terminal.c

index f32e9cae4c993c90bbad9edad4618e1928fbc73d..5302998fe969b300b4c15b244e038091a5a6148c 100644 (file)
--- a/logging.c
+++ b/logging.c
@@ -34,6 +34,16 @@ void logtraffic(void *handle, unsigned char c, int logmode)
     }
 }
 
+/*
+ * Flush any open log file.
+ */
+void logflush(void *handle) {
+    struct LogContext *ctx = (struct LogContext *)handle;
+    if (ctx->cfg.logtype > 0)
+       if (ctx->lgfp)
+           fflush(ctx->lgfp);
+}
+
 /*
  * Log an Event Log entry. Used in SSH packet logging mode; this is
  * also as convenient a place as any to put the output of Event Log
diff --git a/putty.h b/putty.h
index 6d4d83aec054e88752dd1985f7848f4ccbaf1fc6..3fb26bcc17efe64c4bbb20209ab174af851a1c02 100644 (file)
--- a/putty.h
+++ b/putty.h
@@ -655,6 +655,7 @@ void log_reconfig(void *logctx, Config *cfg);
 void logfopen(void *logctx);
 void logfclose(void *logctx);
 void logtraffic(void *logctx, unsigned char c, int logmode);
+void logflush(void *logctx);
 void log_eventlog(void *logctx, const char *string);
 enum { PKT_INCOMING, PKT_OUTGOING };
 void log_packet(void *logctx, int direction, int type,
index bf531eee8252e557c31ca44b0c8a81cf7e45f279..00fd7c85c690544fe34d70c40cffded429820b64 100644 (file)
@@ -3311,6 +3311,7 @@ void term_out(Terminal *term)
     }
 
     term_print_flush(term);
+    logflush(term->logctx);
 }
 
 #if 0