Re: [Spice-devel] [PATCH 05/14] Rename 'quit' to 'quit_requested' for consistency with 'streaming_requested'

2018-02-14 Thread Frediano Ziglio
> 
> From: Christophe de Dinechin 
> 
> Signed-off-by: Christophe de Dinechin 
> ---
>  src/spice-streaming-agent.cpp | 16 
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
> index 5fb20d1..e345d99 100644
> --- a/src/spice-streaming-agent.cpp
> +++ b/src/spice-streaming-agent.cpp
> @@ -54,8 +54,8 @@ struct SpiceStreamDataMessage
>  };
>  
>  static bool streaming_requested = false;
> +static bool quit_requested = false;
>  static std::set client_codecs;
> -static bool quit;
>  static int streamfd = -1;
>  static bool stdin_ok;
>  static int log_binary = 0;
> @@ -96,7 +96,7 @@ static int read_command_from_stdin(void)
>  if (!cmd)
>  return 1;
>  if (strcmp(cmd, "quit") == 0) {
> -quit = true;
> +quit_requested = true;
>  } else if (strcmp(cmd, "start") == 0) {
>  streaming_requested = true;
>  } else if (strcmp(cmd, "stop") == 0) {
> @@ -156,7 +156,7 @@ static int read_command(bool blocking)
>  {
>  int fd, n=1;
>  int timeout = blocking?-1:0;
> -while (!quit) {
> +while (!quit_requested) {
>  if (!have_something_to_read(, timeout)) {
>  if (!blocking) {
>  return 0;
> @@ -258,7 +258,7 @@ static uint64_t get_time(void)
>  static void handle_interrupt(int intr)
>  {
>  syslog(LOG_INFO, "Got signal %d, exiting", intr);
> -quit = true;
> +quit_requested = true;
>  }
>  
>  static void register_interrupts(void)
> @@ -360,15 +360,15 @@ do_capture(const std::string , FILE *f_log)
>   streamport + "): " + strerror(errno));
>  
>  unsigned int frame_count = 0;
> -while (! quit) {
> -while (!quit && !streaming_requested) {
> +while (!quit_requested) {
> +while (!quit_requested && !streaming_requested) {
>  if (read_command(true) < 0) {
>  syslog(LOG_ERR, "FAILED to read command\n");
>  goto done;
>  }
>  }
>  
> -if (quit)
> +if (quit_requested)
>  return;
>  
>  syslog(LOG_INFO, "streaming starts now\n");

Maybe we could add brackets here to fix the style?

> @@ -378,7 +378,7 @@ do_capture(const std::string , FILE *f_log)
>  if (!capture)
>  throw std::runtime_error("cannot find a suitable capture
>  system");
>  
> -while (!quit && streaming_requested) {
> +while (!quit_requested && streaming_requested) {
>  if (++frame_count % 100 == 0) {
>  syslog(LOG_DEBUG, "SENT %d frames\n", frame_count);
>  }

otherwise,

Acked-by: Frediano Ziglio 

Frediano
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH 05/14] Rename 'quit' to 'quit_requested' for consistency with 'streaming_requested'

2018-02-14 Thread Christophe de Dinechin
From: Christophe de Dinechin 

Signed-off-by: Christophe de Dinechin 
---
 src/spice-streaming-agent.cpp | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
index 5fb20d1..e345d99 100644
--- a/src/spice-streaming-agent.cpp
+++ b/src/spice-streaming-agent.cpp
@@ -54,8 +54,8 @@ struct SpiceStreamDataMessage
 };
 
 static bool streaming_requested = false;
+static bool quit_requested = false;
 static std::set client_codecs;
-static bool quit;
 static int streamfd = -1;
 static bool stdin_ok;
 static int log_binary = 0;
@@ -96,7 +96,7 @@ static int read_command_from_stdin(void)
 if (!cmd)
 return 1;
 if (strcmp(cmd, "quit") == 0) {
-quit = true;
+quit_requested = true;
 } else if (strcmp(cmd, "start") == 0) {
 streaming_requested = true;
 } else if (strcmp(cmd, "stop") == 0) {
@@ -156,7 +156,7 @@ static int read_command(bool blocking)
 {
 int fd, n=1;
 int timeout = blocking?-1:0;
-while (!quit) {
+while (!quit_requested) {
 if (!have_something_to_read(, timeout)) {
 if (!blocking) {
 return 0;
@@ -258,7 +258,7 @@ static uint64_t get_time(void)
 static void handle_interrupt(int intr)
 {
 syslog(LOG_INFO, "Got signal %d, exiting", intr);
-quit = true;
+quit_requested = true;
 }
 
 static void register_interrupts(void)
@@ -360,15 +360,15 @@ do_capture(const std::string , FILE *f_log)
  streamport + "): " + strerror(errno));
 
 unsigned int frame_count = 0;
-while (! quit) {
-while (!quit && !streaming_requested) {
+while (!quit_requested) {
+while (!quit_requested && !streaming_requested) {
 if (read_command(true) < 0) {
 syslog(LOG_ERR, "FAILED to read command\n");
 goto done;
 }
 }
 
-if (quit)
+if (quit_requested)
 return;
 
 syslog(LOG_INFO, "streaming starts now\n");
@@ -378,7 +378,7 @@ do_capture(const std::string , FILE *f_log)
 if (!capture)
 throw std::runtime_error("cannot find a suitable capture system");
 
-while (!quit && streaming_requested) {
+while (!quit_requested && streaming_requested) {
 if (++frame_count % 100 == 0) {
 syslog(LOG_DEBUG, "SENT %d frames\n", frame_count);
 }
-- 
2.13.5 (Apple Git-94)

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel