Commit a4d94745cd55c1b8828e5cac8befa00a716ef5e7
1 parent
b011c6dc
Exists in
master
and in
5 other branches
Corrigindo erro na restauração de sessão.
Showing
2 changed files
with
12 additions
and
3 deletions
Show diff stats
src/libpw3270cpp/service.cc
@@ -287,11 +287,12 @@ | @@ -287,11 +287,12 @@ | ||
287 | if(*session != '?') | 287 | if(*session != '?') |
288 | { | 288 | { |
289 | // Já tem sessão definida, usa. | 289 | // Já tem sessão definida, usa. |
290 | - this->name = session; | ||
291 | - int rc = getInteger("chkId"); | 290 | + int rc = getInteger("chkId",DBUS_TYPE_STRING, &session, DBUS_TYPE_INVALID); |
292 | if(rc) { | 291 | if(rc) { |
293 | throw exception("%s",strerror(rc)); | 292 | throw exception("%s",strerror(rc)); |
294 | } | 293 | } |
294 | + this->name = "service://"; | ||
295 | + this->name += session; | ||
295 | } | 296 | } |
296 | else | 297 | else |
297 | { | 298 | { |
src/libpw3270cpp/testprogram.cc
@@ -46,9 +46,11 @@ | @@ -46,9 +46,11 @@ | ||
46 | // session *session = session::start(""); | 46 | // session *session = session::start(""); |
47 | // session *session = session::start("new"); | 47 | // session *session = session::start("new"); |
48 | 48 | ||
49 | + string name = session->get_session_name(); | ||
50 | + | ||
49 | cout << "pw3270 version: " << session->get_version() << endl; | 51 | cout << "pw3270 version: " << session->get_version() << endl; |
50 | cout << "pw3270 revision: " << session->get_revision() << endl; | 52 | cout << "pw3270 revision: " << session->get_revision() << endl; |
51 | - cout << "pw3270 session: " << session->get_session_name() << endl << endl; | 53 | + cout << "pw3270 session: " << name << endl << endl; |
52 | 54 | ||
53 | session->set_timeout(60); | 55 | session->set_timeout(60); |
54 | session->set_autoclose(60); | 56 | session->set_autoclose(60); |
@@ -77,9 +79,15 @@ | @@ -77,9 +79,15 @@ | ||
77 | cout << "Conteúdo:" << endl << session->get_contents() << endl; | 79 | cout << "Conteúdo:" << endl << session->get_contents() << endl; |
78 | 80 | ||
79 | session->disconnect(); | 81 | session->disconnect(); |
82 | + | ||
83 | + delete session; | ||
84 | + | ||
85 | + session = session::start(name.c_str()); | ||
86 | + cout << "Restored session: " << name << endl << endl; | ||
80 | session->close(); | 87 | session->close(); |
81 | 88 | ||
82 | delete session; | 89 | delete session; |
90 | + | ||
83 | } | 91 | } |
84 | catch(std::exception &e) { | 92 | catch(std::exception &e) { |
85 | 93 |