From 1d9706d1235b353fb45a2753f9ce4edfc5eb297b Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Fri, 16 Aug 2019 12:27:57 -0300 Subject: [PATCH] Fixing timing errors. --- client/src/core/host.cc | 6 +++++- client/src/session/local/actions.cc | 1 - client/src/testprogram/testprogram.cc | 4 +++- common/src/include/lib3270/ipc.h | 6 ++---- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/client/src/core/host.cc b/client/src/core/host.cc index dadbf67..028d30a 100644 --- a/client/src/core/host.cc +++ b/client/src/core/host.cc @@ -67,7 +67,6 @@ Host & Host::connect(const char *url) { this->session->connect(url,timeout); - this->sync(); return *this; } @@ -101,6 +100,11 @@ } + Host::operator bool() const { + const_cast(this)->sync(); + return isReady(); + } + bool Host::isReady() const { return getProgramMessage() == MESSAGE_NONE; } diff --git a/client/src/session/local/actions.cc b/client/src/session/local/actions.cc index 22e2409..c9f3aca 100644 --- a/client/src/session/local/actions.cc +++ b/client/src/session/local/actions.cc @@ -71,7 +71,6 @@ std::lock_guard lock(const_cast(this)->sync); chkResponse(lib3270_wait_for_ready(this->hSession, timeout)); - } void Local::Session::waitForChange(unsigned short seconds) const { diff --git a/client/src/testprogram/testprogram.cc b/client/src/testprogram/testprogram.cc index 2c3925b..f434376 100644 --- a/client/src/testprogram/testprogram.cc +++ b/client/src/testprogram/testprogram.cc @@ -104,12 +104,14 @@ << "Luname is " << host.getLUName() << std::endl << std::endl; + if(host) { + cout << host << endl; + } // host.input("test@0another line"); //host.connect(); //if(host) { - // cout << host << endl; //} } catch(const std::exception &e) { diff --git a/common/src/include/lib3270/ipc.h b/common/src/include/lib3270/ipc.h index a21b67b..fb4dafd 100644 --- a/common/src/include/lib3270/ipc.h +++ b/common/src/include/lib3270/ipc.h @@ -209,7 +209,7 @@ WORD_NEXT, FIELD_END, ///< @brief Move the cursor to the first blank after the last nonblank in the field. FIELD_FIRST, ///< @brief Move to first unprotected field on screen. - FIELD_NEXT, + FIELD_NEXT, ///< @brief Jump to the next field. FIELD_PREVIOUS, ///< @brief Tab backward to previous field. ATTN, ///< @brief ATTN key, per RFC 2355. Sends IP, regardless. BREAK, @@ -430,9 +430,7 @@ return session->getProgramMessage(); } - inline operator bool() const { - return isReady(); - } + operator bool() const; inline operator ProgramMessage() const { return getProgramMessage(); -- libgit2 0.21.2