Commit abf1107e98f214e2ff0d0207f505443bc54a3c06

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

Updating convenience object.

client/src/core/host.cc
@@ -65,11 +65,9 @@ @@ -65,11 +65,9 @@
65 this->session = nullptr; 65 this->session = nullptr;
66 } 66 }
67 67
68 - Host & Host::connect(const char *url, bool sync) {  
69 - this->session->connect(url);  
70 - if(sync) {  
71 - this->sync();  
72 - } 68 + Host & Host::connect(const char *url) {
  69 + this->session->connect(url,timeout);
  70 + this->sync();
73 return *this; 71 return *this;
74 } 72 }
75 73
client/src/session/local/actions.cc
@@ -48,10 +48,10 @@ @@ -48,10 +48,10 @@
48 chkResponse(lib3270_action(hSession,action_name)); 48 chkResponse(lib3270_action(hSession,action_name));
49 } 49 }
50 50
51 - void Local::Session::connect(const char *url, bool wait) { 51 + void Local::Session::connect(const char *url, int seconds) {
52 52
53 std::lock_guard<std::mutex> lock(sync); 53 std::lock_guard<std::mutex> lock(sync);
54 - chkResponse(lib3270_connect_url(hSession,url,(wait ? 1 : 0))); 54 + chkResponse(lib3270_connect_url(hSession,url,seconds));
55 } 55 }
56 56
57 void Local::Session::disconnect() { 57 void Local::Session::disconnect() {
client/src/session/local/private.h
@@ -93,7 +93,7 @@ @@ -93,7 +93,7 @@
93 93
94 // Actions 94 // Actions
95 void action(const char *action_name) override; 95 void action(const char *action_name) override;
96 - void connect(const char *url, bool wait) override; 96 + void connect(const char *url, int seconds) override;
97 void disconnect() override; 97 void disconnect() override;
98 void pfkey(unsigned short value) override; 98 void pfkey(unsigned short value) override;
99 void pakey(unsigned short value) override; 99 void pakey(unsigned short value) override;
client/src/testprogram/testprogram.cc
@@ -87,7 +87,7 @@ @@ -87,7 +87,7 @@
87 // test host object 87 // test host object
88 static void testHost(const char *session) { 88 static void testHost(const char *session) {
89 89
90 - TN3270::Host host{session}; 90 + TN3270::Host host{session,nullptr,10};
91 91
92 try { 92 try {
93 93
@@ -96,7 +96,7 @@ @@ -96,7 +96,7 @@
96 << "\tRevision: " << host.getRevision() 96 << "\tRevision: " << host.getRevision()
97 << std::endl; 97 << std::endl;
98 98
99 - host.connect(); 99 + host.connect(nullptr);
100 100
101 cout 101 cout
102 << "Connection state is " << toCharString(host.getConnectionState()) << std::endl 102 << "Connection state is " << toCharString(host.getConnectionState()) << std::endl
common/src/include/lib3270/ipc.h
@@ -322,7 +322,7 @@ @@ -322,7 +322,7 @@
322 virtual void action(const char *action_name) = 0; 322 virtual void action(const char *action_name) = 0;
323 323
324 // Connect/disconnect 324 // Connect/disconnect
325 - virtual void connect(const char *url = nullptr, bool wait = true) = 0; 325 + virtual void connect(const char *url = nullptr, int seconds = DEFAULT_TIMEOUT) = 0;
326 virtual void disconnect() = 0; 326 virtual void disconnect() = 0;
327 327
328 /// @brief Wait. 328 /// @brief Wait.
@@ -416,7 +416,7 @@ @@ -416,7 +416,7 @@
416 } 416 }
417 417
418 // Actions 418 // Actions
419 - Host & connect(const char *url = nullptr, bool sync = true); 419 + Host & connect(const char *url = nullptr);
420 Host & disconnect(); 420 Host & disconnect();
421 Host & waitForReady(time_t timeout = DEFAULT_TIMEOUT); 421 Host & waitForReady(time_t timeout = DEFAULT_TIMEOUT);
422 422