summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2017-11-21 17:28:27 +0000
committerFrediano Ziglio <fziglio@redhat.com>2017-11-23 11:39:01 +0000
commiteb09773f7f9dfef42e0ac5ed1e647485b3929400 (patch)
tree3cbd321fc646aa91a2782a07161fb92eb559dc23
parent77b3f317f5127c8854caf118f25006a1b538c005 (diff)
SAVE
-rw-r--r--src/spice-streaming-agent.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
index 2636245..7c80003 100644
--- a/src/spice-streaming-agent.cpp
+++ b/src/spice-streaming-agent.cpp
@@ -69,8 +69,7 @@ public:
public:
bool have_something_to_read(int *pfd, int timeout);
- int read_command_from_device(void);
- int read_command(bool blocking);
+ int read_command();
int send_format(unsigned w, unsigned h, unsigned c);
int send_frame(const void *buf, const unsigned size);
void send_cursor(unsigned width, unsigned height, int hotspot_x, int hotspot_y,
@@ -140,7 +139,7 @@ static int read_command_from_stdin(void)
return 1;
}
-int SpiceStream::read_command_from_device(void)
+int SpiceStream::read_command()
{
StreamDevHeader hdr;
uint8_t msg[64];
@@ -182,12 +181,12 @@ int SpiceStream::read_command_from_device(void)
return 1;
}
-int SpiceStream::read_command(bool blocking)
+static int read_command(SpiceStream &stream, bool blocking)
{
int fd, n=1;
int timeout = blocking?-1:0;
while (!quit) {
- if (!have_something_to_read(&fd, timeout)) {
+ if (!stream.have_something_to_read(&fd, timeout)) {
if (!blocking) {
return 0;
}
@@ -195,7 +194,7 @@ int SpiceStream::read_command(bool blocking)
continue;
}
if (fd) {
- n = read_command_from_device();
+ n = stream.read_command();
} else {
n = read_command_from_stdin();
}
@@ -394,7 +393,7 @@ do_capture(const char *streamport, FILE *f_log, Display *display, int event_base
unsigned int frame_count = 0;
while (! quit) {
while (!quit && !streaming_requested) {
- if (stream.read_command(true) < 0) {
+ if (read_command(stream, true) < 0) {
syslog(LOG_ERR, "FAILED to read command\n");
return;
}
@@ -445,7 +444,7 @@ do_capture(const char *streamport, FILE *f_log, Display *display, int event_base
break;
}
//usleep(1);
- if (stream.read_command(false) < 0) {
+ if (read_command(stream, false) < 0) {
syslog(LOG_ERR, "FAILED to read command\n");
return;
}