From 9209d08d422f1568249c6a33a0f0860d0ddd34ff Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Fri, 31 Jul 2020 17:35:10 -0300 Subject: [PATCH] Fixing connection issues. --- src/core/calls.cc | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/core/calls.cc b/src/core/calls.cc index 6dcec6e..831fc4d 100644 --- a/src/core/calls.cc +++ b/src/core/calls.cc @@ -50,10 +50,12 @@ { try { - getSession().connect((const char *) uri); + TN3270::Host &host = getSession(); + + host.connect((const char *) uri); if(wait) - return hllapi_wait_for_ready(wait); + host.wait(TN3270::CONNECTED_TN3270E); } catch(const std::exception &e) { @@ -183,6 +185,26 @@ } + HLLAPI_API_CALL hllapi_wait_for_cstate(WORD seconds, WORD cstate) { + + try { + + TN3270::Host &host = getSession(); + + host.wait((TN3270::ConnectionState) cstate, (unsigned int) seconds); + + return 0; + + } catch(const std::exception &e) { + + hllapi_lasterror = e.what(); + + } + + return HLLAPI_STATUS_SYSTEM_ERROR; + + } + HLLAPI_API_CALL hllapi_wait_for_change(WORD seconds) { try { -- libgit2 0.21.2