GUACAMOLE-597: Add flag for forcing automatic flushing of pipe stream.

Project: http://git-wip-us.apache.org/repos/asf/guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-server/commit/e66178ff
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-server/tree/e66178ff
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-server/diff/e66178ff

Branch: refs/heads/master
Commit: e66178ff9abee8e38f11f4241068015cba6073f0
Parents: 99b17b0
Author: Michael Jumper <mjum...@apache.org>
Authored: Sun Jul 1 22:45:01 2018 -0700
Committer: Michael Jumper <mjum...@apache.org>
Committed: Fri Jul 27 14:23:50 2018 -0700

----------------------------------------------------------------------
 src/terminal/terminal.c          |  4 ++++
 src/terminal/terminal/terminal.h | 10 ++++++++++
 2 files changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/e66178ff/src/terminal/terminal.c
----------------------------------------------------------------------
diff --git a/src/terminal/terminal.c b/src/terminal/terminal.c
index 5a106ad..184a323 100644
--- a/src/terminal/terminal.c
+++ b/src/terminal/terminal.c
@@ -1551,6 +1551,10 @@ void guac_terminal_flush(guac_terminal* terminal) {
     if (terminal->typescript != NULL)
         guac_terminal_typescript_flush(terminal->typescript);
 
+    /* Flush pipe stream if automatic flushing is enabled */
+    if (terminal->pipe_stream_flags & GUAC_TERMINAL_PIPE_AUTOFLUSH)
+        guac_terminal_pipe_stream_flush(terminal);
+
     /* Flush display state */
     guac_terminal_select_redraw(terminal);
     guac_terminal_commit_cursor(terminal);

http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/e66178ff/src/terminal/terminal/terminal.h
----------------------------------------------------------------------
diff --git a/src/terminal/terminal/terminal.h b/src/terminal/terminal/terminal.h
index 4e04fc7..730deec 100644
--- a/src/terminal/terminal/terminal.h
+++ b/src/terminal/terminal/terminal.h
@@ -105,6 +105,14 @@
  */
 #define GUAC_TERMINAL_PIPE_INTERPRET_OUTPUT 1
 
+/**
+ * Flag which forces the open pipe stream to be flushed automatically, whenever
+ * a new frame would be rendered, with only minimal buffering performed between
+ * frames. By default, the contents of the pipe stream will be flushed only
+ * when the buffer is full or the pipe stream is being closed.
+ */
+#define GUAC_TERMINAL_PIPE_AUTOFLUSH 2
+
 typedef struct guac_terminal guac_terminal;
 
 /**
@@ -228,6 +236,7 @@ struct guac_terminal {
      * are undefined.
      *
      * @see GUAC_TERMINAL_PIPE_INTERPRET_OUTPUT
+     * @see GUAC_TERMINAL_PIPE_AUTOFLUSH
      */
     int pipe_stream_flags;
 
@@ -942,6 +951,7 @@ int guac_terminal_next_tab(guac_terminal* term, int column);
  *     stream.
  *
  *     @see GUAC_TERMINAL_PIPE_INTERPRET_OUTPUT
+ *     @see GUAC_TERMINAL_PIPE_AUTOFLUSH
  */
 void guac_terminal_pipe_stream_open(guac_terminal* term, const char* name,
         int flags);

Reply via email to