Commit ed00bf6677c05b7479d8c954e2eea980b42f8996

Authored by Perry Werneck
1 parent 9d913eee
Exists in master and in 2 other branches develop, macos

Allowing customized reconnect method.

src/core/actions/table.c
@@ -48,7 +48,7 @@ @@ -48,7 +48,7 @@
48 48
49 static int connect_host(H3270 *hSession) 49 static int connect_host(H3270 *hSession)
50 { 50 {
51 - return lib3270_reconnect(hSession,0); 51 + return hSession->cbk.reconnect(hSession,0);
52 } 52 }
53 53
54 static int select_up(H3270 *hSession) 54 static int select_up(H3270 *hSession)
src/core/connect.c
@@ -49,7 +49,7 @@ @@ -49,7 +49,7 @@
49 lib3270_set_url(hSession,url); 49 lib3270_set_url(hSession,url);
50 } 50 }
51 51
52 - return lib3270_reconnect(hSession, seconds); 52 + return hSession->cbk.reconnect(hSession, seconds);
53 53
54 } 54 }
55 55
src/core/host.c
@@ -74,7 +74,7 @@ static int check_for_auto_reconnect(H3270 *hSession, void GNUC_UNUSED(*userdata) @@ -74,7 +74,7 @@ static int check_for_auto_reconnect(H3270 *hSession, void GNUC_UNUSED(*userdata)
74 { 74 {
75 lib3270_write_log(hSession,"3270","Starting auto-reconnect on %s",lib3270_get_url(hSession)); 75 lib3270_write_log(hSession,"3270","Starting auto-reconnect on %s",lib3270_get_url(hSession));
76 hSession->auto_reconnect_inprogress = 0; // Reset "in-progress" to allow reconnection. 76 hSession->auto_reconnect_inprogress = 0; // Reset "in-progress" to allow reconnection.
77 - if(lib3270_reconnect(hSession,0)) 77 + if(hSession->cbk.reconnect(hSession,0))
78 lib3270_write_log(hSession,"3270","Auto-reconnect fails: %s",strerror(errno)); 78 lib3270_write_log(hSession,"3270","Auto-reconnect fails: %s",strerror(errno));
79 } 79 }
80 80
src/core/session.c
@@ -305,6 +305,7 @@ void lib3270_reset_callbacks(H3270 *hSession) @@ -305,6 +305,7 @@ void lib3270_reset_callbacks(H3270 *hSession)
305 hSession->cbk.update_luname = default_update_luname; 305 hSession->cbk.update_luname = default_update_luname;
306 hSession->cbk.update_url = default_update_url; 306 hSession->cbk.update_url = default_update_url;
307 hSession->cbk.action = default_action; 307 hSession->cbk.action = default_action;
  308 + hSession->cbk.reconnect = lib3270_reconnect;
308 309
309 lib3270_set_popup_handler(hSession, NULL); 310 lib3270_set_popup_handler(hSession, NULL);
310 311
@@ -551,9 +552,11 @@ LIB3270_EXPORT char lib3270_get_session_id(H3270 *hSession) @@ -551,9 +552,11 @@ LIB3270_EXPORT char lib3270_get_session_id(H3270 *hSession)
551 552
552 struct lib3270_session_callbacks * lib3270_get_session_callbacks(H3270 *hSession, const char *revision, unsigned short sz) 553 struct lib3270_session_callbacks * lib3270_get_session_callbacks(H3270 *hSession, const char *revision, unsigned short sz)
553 { 554 {
554 - if(revision && strcasecmp(revision,"20200803") < 0) 555 + #define REQUIRED_REVISION "20201117"
  556 +
  557 + if(revision && strcasecmp(revision,REQUIRED_REVISION) < 0)
555 { 558 {
556 - debug("%s: Revision test was %d",__FUNCTION__,strcasecmp(revision,"20200803")); 559 + debug("%s: Revision test was %d",__FUNCTION__,strcasecmp(revision,REQUIRED_REVISION));
557 errno = EINVAL; 560 errno = EINVAL;
558 return NULL; 561 return NULL;
559 } 562 }
src/core/toggles/init.c
@@ -100,7 +100,7 @@ static void toggle_connect(H3270 *hSession, const struct lib3270_toggle *toggle, @@ -100,7 +100,7 @@ static void toggle_connect(H3270 *hSession, const struct lib3270_toggle *toggle,
100 { 100 {
101 if(tt != LIB3270_TOGGLE_TYPE_INITIAL && lib3270_is_disconnected(hSession) && toggle->value) 101 if(tt != LIB3270_TOGGLE_TYPE_INITIAL && lib3270_is_disconnected(hSession) && toggle->value)
102 { 102 {
103 - if(lib3270_reconnect(hSession,0)) 103 + if(hSession->cbk.reconnect(hSession,0))
104 lib3270_write_log(hSession,"3270","Auto-connect fails: %s",strerror(errno)); 104 lib3270_write_log(hSession,"3270","Auto-connect fails: %s",strerror(errno));
105 } 105 }
106 106
src/include/lib3270/session.h
@@ -79,6 +79,7 @@ @@ -79,6 +79,7 @@
79 79
80 int (*action)(H3270 *hSession, const char *name); 80 int (*action)(H3270 *hSession, const char *name);
81 81
  82 + int (*reconnect)(H3270 *hSession,int seconds);
82 }; 83 };
83 84
84 /** 85 /**