From 8d1d84b0f7b9cc50bf7c3975a3e3c2ffc7ca35dd Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Mon, 10 Aug 2020 17:39:53 -0300 Subject: [PATCH] Fixing popup dialog when connection fails. --- src/core/connect.c | 2 ++ src/core/linux/connect.c | 4 +++- src/core/popup.c | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/core/connect.c b/src/core/connect.c index 09ccb08..e00c546 100644 --- a/src/core/connect.c +++ b/src/core/connect.c @@ -86,6 +86,7 @@ // if(hSession->auto_reconnect_inprogress) { + debug("%s: auto_reconnect_inprogress",__FUNCTION__); errno = EBUSY; return 0; } @@ -93,6 +94,7 @@ // Is the session disconnected? if(!lib3270_is_disconnected(hSession)) { + debug("%s: is_disconnected=FALSE",__FUNCTION__); errno = EISCONN; return 0; } diff --git a/src/core/linux/connect.c b/src/core/linux/connect.c index e0add24..6b955a2 100644 --- a/src/core/linux/connect.c +++ b/src/core/linux/connect.c @@ -292,7 +292,9 @@ popup->body = syserror; } - if(hSession->cbk.popup(hSession,popup,!hSession->auto_reconnect_inprogress) == 0) + lib3270_disconnect(hSession); // To cleanup states. + + if(lib3270_popup(hSession,popup,!hSession->auto_reconnect_inprogress) == 0) lib3270_activate_auto_reconnect(hSession,1000); return errno = ENOTCONN; diff --git a/src/core/popup.c b/src/core/popup.c index db75fe4..92824bb 100644 --- a/src/core/popup.c +++ b/src/core/popup.c @@ -42,7 +42,9 @@ /*--[ Implement ]------------------------------------------------------------------------------------*/ LIB3270_EXPORT int lib3270_popup(H3270 *hSession, const LIB3270_POPUP *popup, unsigned char wait) { - return hSession->cbk.popup(hSession,popup,wait); + int rc = hSession->cbk.popup(hSession,popup,wait); + debug("%s rc=%d (%s)",__FUNCTION__,rc,strerror(rc)); + return rc; } int lib3270_popup_translated(H3270 *hSession, const LIB3270_POPUP *popup, unsigned char wait) { -- libgit2 0.21.2