aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-06-22 11:59:39 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-06-22 11:59:39 +0200
commit90b1fc64ec00b974010a2218a6b80554648dc75c (patch)
treeed036dd0741ebc19f8888a381560c1c8055a0487
parent9febd2606f8576c6e7cdb950211ec831da168c3a (diff)
Make communication with QEMU monitor more robust
-rw-r--r--bbot/agent/machine.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/bbot/agent/machine.cxx b/bbot/agent/machine.cxx
index 0431a2f..a8933bb 100644
--- a/bbot/agent/machine.cxx
+++ b/bbot/agent/machine.cxx
@@ -4,7 +4,7 @@
#include <bbot/agent/machine.hxx>
-#include <unistd.h> // sleep()
+#include <unistd.h> // sleep(), usleep()
#include <sys/un.h> // sockaddr_un
#include <sys/socket.h>
@@ -425,6 +425,8 @@ namespace bbot
void kvm_machine::
monitor_command (const string& c)
{
+ tracer trace ("kvm_machine::monitor_command", monitor.string ().c_str ());
+
sockaddr_un addr;
addr.sun_family = AF_LOCAL;
strcpy (addr.sun_path, monitor.string ().c_str ()); // Size check in ctor
@@ -441,7 +443,7 @@ namespace bbot
// Read until we get something.
//
- auto readsome = [&sock] ()
+ auto readsome = [&trace, &sock] ()
{
ifdstream ifs (move (sock),
fdstream_mode::non_blocking,
@@ -456,9 +458,11 @@ namespace bbot
{
n += m;
- //buf[m] = '\0';
- //text << buf;
+ buf[m] = '\0';
+ l5 ([&]{trace << buf;});
}
+
+ usleep (100000); // 0.1s
}
sock = ifs.release ();