Commit 765391db278bcbc9f785b492f545cc30efe2e207
1 parent
6b8da11d
Exists in
master
and in
1 other branch
Fixing performance issues.
Showing
1 changed file
with
62 additions
and
19 deletions
Show diff stats
src/core/set.cc
... | ... | @@ -44,27 +44,70 @@ |
44 | 44 | |
45 | 45 | TN3270::Host &host = getSession(); |
46 | 46 | |
47 | - kLock = host.waitForKeyboardUnlock(); | |
48 | - | |
49 | - if(kLock == LIB3270_KL_UNLOCKED) { | |
50 | - | |
51 | - try { | |
52 | - | |
53 | - worker(host); | |
54 | - return HLLAPI_STATUS_SUCCESS; | |
55 | - | |
56 | - } catch(const std::exception &e) { | |
57 | - | |
58 | - // Worker has failed! | |
59 | - | |
60 | - hllapi_lasterror = e.what(); | |
61 | - } | |
62 | - | |
63 | - // Failed! Get lock state. | |
64 | - kLock = host.getKeyboardLockState(); | |
65 | - | |
47 | + switch(host.waitForKeyboardUnlock()) { | |
48 | + case LIB3270_KL_UNLOCKED: | |
49 | + worker(host); | |
50 | + break; | |
51 | + | |
52 | + case LIB3270_KL_NOT_CONNECTED: | |
53 | + hllapi_lasterror = _("Not connected to host"); | |
54 | + return HLLAPI_STATUS_DISCONNECTED; | |
55 | + | |
56 | + case LIB3270_KL_OERR_MASK: | |
57 | + hllapi_lasterror = _("LIB3270_KL_OERR_MASK"); | |
58 | + return HLLAPI_STATUS_KEYBOARD_LOCKED; | |
59 | + | |
60 | + case LIB3270_KL_OERR_PROTECTED: | |
61 | + hllapi_lasterror = _("LIB3270_KL_OERR_PROTECTED"); | |
62 | + return HLLAPI_STATUS_KEYBOARD_LOCKED; | |
63 | + | |
64 | + case LIB3270_KL_OERR_NUMERIC: | |
65 | + hllapi_lasterror = _("LIB3270_KL_OERR_NUMERIC"); | |
66 | + return HLLAPI_STATUS_KEYBOARD_LOCKED; | |
67 | + | |
68 | + case LIB3270_KL_OERR_OVERFLOW: | |
69 | + hllapi_lasterror = _("LIB3270_KL_OERR_OVERFLOW"); | |
70 | + return HLLAPI_STATUS_KEYBOARD_LOCKED; | |
71 | + | |
72 | + case LIB3270_KL_OERR_DBCS: | |
73 | + hllapi_lasterror = _("LIB3270_KL_OERR_DBCS"); | |
74 | + return HLLAPI_STATUS_KEYBOARD_LOCKED; | |
75 | + | |
76 | + case LIB3270_KL_AWAITING_FIRST: | |
77 | + hllapi_lasterror = _("LIB3270_KL_AWAITING_FIRST"); | |
78 | + return HLLAPI_STATUS_KEYBOARD_LOCKED; | |
79 | + | |
80 | + case LIB3270_KL_OIA_TWAIT: | |
81 | + hllapi_lasterror = _("LIB3270_KL_OIA_TWAIT"); | |
82 | + return HLLAPI_STATUS_KEYBOARD_LOCKED; | |
83 | + | |
84 | + case LIB3270_KL_OIA_LOCKED: | |
85 | + hllapi_lasterror = _("LIB3270_KL_OIA_LOCKED"); | |
86 | + return HLLAPI_STATUS_KEYBOARD_LOCKED; | |
87 | + | |
88 | + case LIB3270_KL_DEFERRED_UNLOCK: | |
89 | + hllapi_lasterror = _("LIB3270_KL_DEFERRED_UNLOCK"); | |
90 | + return HLLAPI_STATUS_KEYBOARD_LOCKED; | |
91 | + | |
92 | + case LIB3270_KL_ENTER_INHIBIT: | |
93 | + hllapi_lasterror = _("LIB3270_KL_ENTER_INHIBIT"); | |
94 | + return HLLAPI_STATUS_KEYBOARD_LOCKED; | |
95 | + | |
96 | + case LIB3270_KL_SCROLLED: | |
97 | + hllapi_lasterror = _("LIB3270_KL_SCROLLED"); | |
98 | + return HLLAPI_STATUS_KEYBOARD_LOCKED; | |
99 | + | |
100 | + case LIB3270_KL_OIA_MINUS: | |
101 | + hllapi_lasterror = _("LIB3270_KL_OIA_MINUS"); | |
102 | + return HLLAPI_STATUS_KEYBOARD_LOCKED; | |
103 | + | |
104 | + default: | |
105 | + hllapi_lasterror = _("Unexpected error waiting for keyboard unlock"); | |
106 | + return HLLAPI_STATUS_SYSTEM_ERROR; | |
66 | 107 | } |
67 | 108 | |
109 | + return HLLAPI_STATUS_SUCCESS; | |
110 | + | |
68 | 111 | } catch(const std::system_error &e) { |
69 | 112 | |
70 | 113 | return hllapi_translate_error(e); | ... | ... |