Commit 3d6bf4b9289db7a035bf835e5a3025d9f501f7cf
1 parent
f90a24cc
Exists in
master
and in
1 other branch
Delaying reconnect action.
Showing
1 changed file
with
24 additions
and
0 deletions
Show diff stats
src/terminal/callbacks.c
| ... | ... | @@ -426,6 +426,29 @@ static void popup_handler(H3270 *session, LIB3270_NOTIFY type, const char *title |
| 426 | 426 | return response; |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | + struct _bg_reconnect | |
| 430 | + { | |
| 431 | + H3270 *hSession; | |
| 432 | + int seconds; | |
| 433 | + }; | |
| 434 | + | |
| 435 | + static gboolean bg_reconnect(struct _bg_reconnect *cfg) | |
| 436 | + { | |
| 437 | + lib3270_reconnect(cfg->hSession,cfg->seconds); | |
| 438 | + return G_SOURCE_REMOVE; | |
| 439 | + } | |
| 440 | + | |
| 441 | + static int reconnect(H3270 *hSession,int seconds) | |
| 442 | + { | |
| 443 | + struct _bg_reconnect *cfg = g_new0(struct _bg_reconnect, 1); | |
| 444 | + | |
| 445 | + cfg->hSession = hSession; | |
| 446 | + cfg->seconds = seconds; | |
| 447 | + | |
| 448 | + g_idle_add_full(G_PRIORITY_DEFAULT_IDLE,(GSourceFunc) bg_reconnect, cfg, g_free); | |
| 449 | + | |
| 450 | + return 0; | |
| 451 | + } | |
| 429 | 452 | |
| 430 | 453 | void v3270_install_callbacks(v3270 *widget) |
| 431 | 454 | { |
| ... | ... | @@ -481,6 +504,7 @@ static void popup_handler(H3270 *session, LIB3270_NOTIFY type, const char *title |
| 481 | 504 | cbk->load = load; |
| 482 | 505 | cbk->popup = popup; |
| 483 | 506 | cbk->action = action; |
| 507 | + cbk->reconnect = reconnect; | |
| 484 | 508 | |
| 485 | 509 | } |
| 486 | 510 | ... | ... |