Commit d5b80b125f50c63edc41abc7ba97c055a486a214

Authored by Perry Werneck
1 parent b63d6671

Can't "auto-reconnect" when the toogle is changed; it conflicts

with the "connect_on_startup" toogle and seens to be causing hangs on
windows version.
Showing 2 changed files with 5 additions and 3 deletions   Show diff stats
src/lib3270/host.c
@@ -69,9 +69,9 @@ int lib3270_check_for_auto_reconnect(H3270 *hSession) @@ -69,9 +69,9 @@ int lib3270_check_for_auto_reconnect(H3270 *hSession)
69 if(hSession->auto_reconnect_inprogress) 69 if(hSession->auto_reconnect_inprogress)
70 { 70 {
71 lib3270_write_log(hSession,"3270","Starting auto-reconnect on %s",lib3270_get_url(hSession)); 71 lib3270_write_log(hSession,"3270","Starting auto-reconnect on %s",lib3270_get_url(hSession));
72 - hSession->auto_reconnect_inprogress = 0; // Reset "in-progress" to allow reconnection.  
73 if(lib3270_reconnect(hSession,0)) 72 if(lib3270_reconnect(hSession,0))
74 lib3270_write_log(hSession,"3270","Auto-reconnect fails: %s",strerror(errno)); 73 lib3270_write_log(hSession,"3270","Auto-reconnect fails: %s",strerror(errno));
  74 + hSession->auto_reconnect_inprogress = 0; // Reset "in-progress" to allow reconnection.
75 } 75 }
76 76
77 return 0; 77 return 0;
src/lib3270/toggles.c
@@ -340,6 +340,7 @@ static void toggle_keepalive(H3270 *session, struct lib3270_toggle *t unused, LI @@ -340,6 +340,7 @@ static void toggle_keepalive(H3270 *session, struct lib3270_toggle *t unused, LI
340 } 340 }
341 } 341 }
342 342
  343 +/*
343 static void toggle_reconnect(H3270 *hSession, struct lib3270_toggle *t unused, LIB3270_TOGGLE_TYPE type ) 344 static void toggle_reconnect(H3270 *hSession, struct lib3270_toggle *t unused, LIB3270_TOGGLE_TYPE type )
344 { 345 {
345 346
@@ -349,13 +350,14 @@ static void toggle_reconnect(H3270 *hSession, struct lib3270_toggle *t unused, L @@ -349,13 +350,14 @@ static void toggle_reconnect(H3270 *hSession, struct lib3270_toggle *t unused, L
349 350
350 if(t->value && !hSession->auto_reconnect_inprogress) 351 if(t->value && !hSession->auto_reconnect_inprogress)
351 { 352 {
352 - /* Schedule an automatic reconnection. */ 353 + // Schedule an automatic reconnection.
353 lib3270_write_log(hSession,"toggle","Auto-reconnect toggle was activated when offline, reconnecting"); 354 lib3270_write_log(hSession,"toggle","Auto-reconnect toggle was activated when offline, reconnecting");
354 hSession->auto_reconnect_inprogress = 1; 355 hSession->auto_reconnect_inprogress = 1;
355 (void) AddTimer(RECONNECT_MS, hSession, lib3270_check_for_auto_reconnect); 356 (void) AddTimer(RECONNECT_MS, hSession, lib3270_check_for_auto_reconnect);
356 } 357 }
357 358
358 } 359 }
  360 +*/
359 361
360 /** 362 /**
361 * @brief Called from system initialization code to handle initial toggle settings. 363 * @brief Called from system initialization code to handle initial toggle settings.
@@ -372,7 +374,7 @@ void initialize_toggles(H3270 *session) @@ -372,7 +374,7 @@ void initialize_toggles(H3270 *session)
372 session->toggle[LIB3270_TOGGLE_UNDERLINE].upcall = toggle_redraw; 374 session->toggle[LIB3270_TOGGLE_UNDERLINE].upcall = toggle_redraw;
373 session->toggle[LIB3270_TOGGLE_ALTSCREEN].upcall = toggle_altscreen; 375 session->toggle[LIB3270_TOGGLE_ALTSCREEN].upcall = toggle_altscreen;
374 session->toggle[LIB3270_TOGGLE_KEEP_ALIVE].upcall = toggle_keepalive; 376 session->toggle[LIB3270_TOGGLE_KEEP_ALIVE].upcall = toggle_keepalive;
375 - session->toggle[LIB3270_TOGGLE_RECONNECT].upcall = toggle_reconnect; 377 +// session->toggle[LIB3270_TOGGLE_RECONNECT].upcall = toggle_reconnect;
376 378
377 for(f=0;f<LIB3270_TOGGLE_COUNT;f++) 379 for(f=0;f<LIB3270_TOGGLE_COUNT;f++)
378 { 380 {