diff --git a/client/src/host/pop.cc b/client/src/host/pop.cc index b6455ae..ad37aad 100644 --- a/client/src/host/pop.cc +++ b/client/src/host/pop.cc @@ -45,7 +45,7 @@ TN3270::Host & TN3270::Host::pop(int baddr, std::string &text) { this->session->waitForReady(this->timeout); if(this->session->getConnectionState() == TN3270::DISCONNECTED) { - throw std::system_error(ENOTCONN, std::system_category()); + chkResponse(ENOTCONN); } session->pop(baddr, text); @@ -58,7 +58,7 @@ TN3270::Host & TN3270::Host::pop(int row, int col, std::string &text) { this->session->waitForReady(this->timeout); if(this->session->getConnectionState() == TN3270::DISCONNECTED) { - throw std::system_error(ENOTCONN, std::system_category()); + chkResponse(ENOTCONN); } session->pop(row,col,text); @@ -71,7 +71,7 @@ TN3270::Host & TN3270::Host::pop(std::string &text) { this->session->waitForReady(this->timeout); if(this->session->getConnectionState() == TN3270::DISCONNECTED) { - throw std::system_error(ENOTCONN, std::system_category()); + chkResponse(ENOTCONN); } session->pop(text); diff --git a/client/src/include/ipc-client-internals.h b/client/src/include/ipc-client-internals.h index 60e1c1d..85e77a0 100644 --- a/client/src/include/ipc-client-internals.h +++ b/client/src/include/ipc-client-internals.h @@ -97,6 +97,9 @@ namespace TN3270 { + /// @brief Check lib3270 return codes, launch exception when failed. + TN3270_PRIVATE void chkResponse(int rc); + namespace Abstract { class TN3270_PRIVATE Session : public TN3270::Session { @@ -142,9 +145,6 @@ virtual void set(int baddr, const std::string &str) = 0; virtual void set(int row, int col, const std::string &str) = 0; - /// @brief Check lib3270 return codes, launch exception when failed. - static void chkResponse(int rc); - public: // Contents diff --git a/client/src/session/remote/actions.cc b/client/src/session/remote/actions.cc index 55b7147..1139fe6 100644 --- a/client/src/session/remote/actions.cc +++ b/client/src/session/remote/actions.cc @@ -71,10 +71,8 @@ .push(url) .call(); - /* if(seconds) this->waitForReady(seconds); - */ } @@ -98,7 +96,7 @@ #endif // _WIN32 if(getConnectionState() == TN3270::DISCONNECTED) - throw std::runtime_error("Disconnected"); + chkResponse(ENOTCONN); } diff --git a/client/src/session/tools.cc b/client/src/session/tools.cc index 705a801..ced1a9e 100644 --- a/client/src/session/tools.cc +++ b/client/src/session/tools.cc @@ -42,7 +42,7 @@ namespace TN3270 { - void Abstract::Session::chkResponse(int rc) { + void chkResponse(int rc) { if(rc == 0) return; diff --git a/client/src/testprogram/testprogram.cc b/client/src/testprogram/testprogram.cc index 711baa6..f53c4e9 100644 --- a/client/src/testprogram/testprogram.cc +++ b/client/src/testprogram/testprogram.cc @@ -98,8 +98,6 @@ host.connect(nullptr); - /* - cout << "Wait for unlock returns " << host.getKeyboardLockState() << std::endl << "Connection state is " << toCharString(host.getConnectionState()) << std::endl @@ -124,8 +122,9 @@ host.pfkey(3); - // host.disconnect(); - */ + host.wait(10); + + host.disconnect(); } catch(const std::exception &e) { -- libgit2 0.21.2