|
@@ -151,13 +151,15 @@ void IoMan::networkMain() {
|
|
|
|
|
|
// read from network
|
|
|
readsize = boost::asio::read_until(*tcpsock, recvbuf, '\n', errcode);
|
|
|
- printDebugMessage(string(__PRETTY_FUNCTION__) + string(" asio::read() ok"));
|
|
|
+ printDebugMessage(string(__PRETTY_FUNCTION__) + string(" asio::read() ok ") + std::to_string(readsize));
|
|
|
+ // printDebugMessage(string("have ") + std::to_string(toprocess.size()) + string(" commands"));
|
|
|
if (errcode && errcode != boost::asio::error::eof) {
|
|
|
printErrorMessage("IoMan::networkMain() couldnt read json data\n" + errcode.message());
|
|
|
continue;
|
|
|
}
|
|
|
-
|
|
|
+ if(!readsize) break;
|
|
|
recvjson = (char *)(boost::asio::buffer_cast<const char *>(recvbuf.data()));
|
|
|
+ recvjson[readsize] = 0;
|
|
|
while(strchr(recvjson, '\n')) {
|
|
|
// parse
|
|
|
jsonsize = strchr(recvjson, '\n') - recvjson + 1;
|
|
@@ -427,6 +429,8 @@ void IoMan::run() {
|
|
|
|
|
|
while(runmain) {
|
|
|
free(line);
|
|
|
+ std::this_thread::yield();
|
|
|
+ std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
|
|
|
|
|
line = readline(getCmdPrompt().c_str());
|
|
|
|