Commit 4e48cc8cc70f729b660c246f6ca871945f823ed3

Authored by Perry Werneck
1 parent 7074ab59
Exists in master and in 1 other branch develop

Fixing bugs in windows modules.

client/src/host/pop.cc
@@ -45,7 +45,7 @@ TN3270::Host & TN3270::Host::pop(int baddr, std::string &text) { @@ -45,7 +45,7 @@ TN3270::Host & TN3270::Host::pop(int baddr, std::string &text) {
45 this->session->waitForReady(this->timeout); 45 this->session->waitForReady(this->timeout);
46 46
47 if(this->session->getConnectionState() == TN3270::DISCONNECTED) { 47 if(this->session->getConnectionState() == TN3270::DISCONNECTED) {
48 - throw std::system_error(ENOTCONN, std::system_category()); 48 + chkResponse(ENOTCONN);
49 } 49 }
50 50
51 session->pop(baddr, text); 51 session->pop(baddr, text);
@@ -58,7 +58,7 @@ TN3270::Host & TN3270::Host::pop(int row, int col, std::string &text) { @@ -58,7 +58,7 @@ TN3270::Host & TN3270::Host::pop(int row, int col, std::string &text) {
58 this->session->waitForReady(this->timeout); 58 this->session->waitForReady(this->timeout);
59 59
60 if(this->session->getConnectionState() == TN3270::DISCONNECTED) { 60 if(this->session->getConnectionState() == TN3270::DISCONNECTED) {
61 - throw std::system_error(ENOTCONN, std::system_category()); 61 + chkResponse(ENOTCONN);
62 } 62 }
63 63
64 session->pop(row,col,text); 64 session->pop(row,col,text);
@@ -71,7 +71,7 @@ TN3270::Host & TN3270::Host::pop(std::string &text) { @@ -71,7 +71,7 @@ TN3270::Host & TN3270::Host::pop(std::string &text) {
71 this->session->waitForReady(this->timeout); 71 this->session->waitForReady(this->timeout);
72 72
73 if(this->session->getConnectionState() == TN3270::DISCONNECTED) { 73 if(this->session->getConnectionState() == TN3270::DISCONNECTED) {
74 - throw std::system_error(ENOTCONN, std::system_category()); 74 + chkResponse(ENOTCONN);
75 } 75 }
76 76
77 session->pop(text); 77 session->pop(text);
client/src/include/ipc-client-internals.h
@@ -97,6 +97,9 @@ @@ -97,6 +97,9 @@
97 97
98 namespace TN3270 { 98 namespace TN3270 {
99 99
  100 + /// @brief Check lib3270 return codes, launch exception when failed.
  101 + TN3270_PRIVATE void chkResponse(int rc);
  102 +
100 namespace Abstract { 103 namespace Abstract {
101 104
102 class TN3270_PRIVATE Session : public TN3270::Session { 105 class TN3270_PRIVATE Session : public TN3270::Session {
@@ -142,9 +145,6 @@ @@ -142,9 +145,6 @@
142 virtual void set(int baddr, const std::string &str) = 0; 145 virtual void set(int baddr, const std::string &str) = 0;
143 virtual void set(int row, int col, const std::string &str) = 0; 146 virtual void set(int row, int col, const std::string &str) = 0;
144 147
145 - /// @brief Check lib3270 return codes, launch exception when failed.  
146 - static void chkResponse(int rc);  
147 -  
148 public: 148 public:
149 149
150 // Contents 150 // Contents
client/src/session/remote/actions.cc
@@ -71,10 +71,8 @@ @@ -71,10 +71,8 @@
71 .push(url) 71 .push(url)
72 .call(); 72 .call();
73 73
74 - /*  
75 if(seconds) 74 if(seconds)
76 this->waitForReady(seconds); 75 this->waitForReady(seconds);
77 - */  
78 76
79 } 77 }
80 78
@@ -98,7 +96,7 @@ @@ -98,7 +96,7 @@
98 #endif // _WIN32 96 #endif // _WIN32
99 97
100 if(getConnectionState() == TN3270::DISCONNECTED) 98 if(getConnectionState() == TN3270::DISCONNECTED)
101 - throw std::runtime_error("Disconnected"); 99 + chkResponse(ENOTCONN);
102 100
103 } 101 }
104 102
client/src/session/tools.cc
@@ -42,7 +42,7 @@ @@ -42,7 +42,7 @@
42 42
43 namespace TN3270 { 43 namespace TN3270 {
44 44
45 - void Abstract::Session::chkResponse(int rc) { 45 + void chkResponse(int rc) {
46 46
47 if(rc == 0) 47 if(rc == 0)
48 return; 48 return;
client/src/testprogram/testprogram.cc
@@ -98,8 +98,6 @@ @@ -98,8 +98,6 @@
98 98
99 host.connect(nullptr); 99 host.connect(nullptr);
100 100
101 - /*  
102 -  
103 cout 101 cout
104 << "Wait for unlock returns " << host.getKeyboardLockState() << std::endl 102 << "Wait for unlock returns " << host.getKeyboardLockState() << std::endl
105 << "Connection state is " << toCharString(host.getConnectionState()) << std::endl 103 << "Connection state is " << toCharString(host.getConnectionState()) << std::endl
@@ -124,8 +122,9 @@ @@ -124,8 +122,9 @@
124 122
125 host.pfkey(3); 123 host.pfkey(3);
126 124
127 - // host.disconnect();  
128 - */ 125 + host.wait(10);
  126 +
  127 + host.disconnect();
129 128
130 } catch(const std::exception &e) { 129 } catch(const std::exception &e) {
131 130