Commit 5c12375cee3fac9141626d56354abaffb310173d
1 parent
5fe43403
Exists in
master
and in
3 other branches
Ajustes para permitir que o aplicativo Android sobreponha todas as funções de I/O de rede
Showing
3 changed files
with
22 additions
and
21 deletions
Show diff stats
host.c
| @@ -52,6 +52,7 @@ | @@ -52,6 +52,7 @@ | ||
| 52 | #include "xioc.h" | 52 | #include "xioc.h" |
| 53 | 53 | ||
| 54 | #include <errno.h> | 54 | #include <errno.h> |
| 55 | +#include <lib3270/internals.h> | ||
| 55 | 56 | ||
| 56 | #define RECONNECT_MS 2000 /* 2 sec before reconnecting to host */ | 57 | #define RECONNECT_MS 2000 /* 2 sec before reconnecting to host */ |
| 57 | #define RECONNECT_ERR_MS 5000 /* 5 sec before reconnecting to host */ | 58 | #define RECONNECT_ERR_MS 5000 /* 5 sec before reconnecting to host */ |
| @@ -550,7 +551,7 @@ static int do_connect(H3270 *hSession, const char *n) | @@ -550,7 +551,7 @@ static int do_connect(H3270 *hSession, const char *n) | ||
| 550 | if(net_connect(hSession, chost, port, 0, &resolving,&pending) != 0 && !resolving) | 551 | if(net_connect(hSession, chost, port, 0, &resolving,&pending) != 0 && !resolving) |
| 551 | { | 552 | { |
| 552 | /* Redundantly signal a disconnect. */ | 553 | /* Redundantly signal a disconnect. */ |
| 553 | - host_disconnected(hSession); | 554 | + lib3270_set_disconnected(hSession); |
| 554 | return -1; | 555 | return -1; |
| 555 | } | 556 | } |
| 556 | 557 | ||
| @@ -588,7 +589,7 @@ static int do_connect(H3270 *hSession, const char *n) | @@ -588,7 +589,7 @@ static int do_connect(H3270 *hSession, const char *n) | ||
| 588 | } | 589 | } |
| 589 | else | 590 | else |
| 590 | { | 591 | { |
| 591 | - host_connected(hSession); | 592 | + lib3270_set_connected(hSession); |
| 592 | } | 593 | } |
| 593 | 594 | ||
| 594 | return 0; | 595 | return 0; |
| @@ -687,7 +688,7 @@ void host_disconnect(H3270 *h, int failed) | @@ -687,7 +688,7 @@ void host_disconnect(H3270 *h, int failed) | ||
| 687 | trace_ansi_disc(); | 688 | trace_ansi_disc(); |
| 688 | #endif /*]*/ | 689 | #endif /*]*/ |
| 689 | 690 | ||
| 690 | - host_disconnected(h); | 691 | + lib3270_set_disconnected(h); |
| 691 | } | 692 | } |
| 692 | } | 693 | } |
| 693 | 694 | ||
| @@ -703,22 +704,24 @@ void host_in3270(H3270 *session, LIB3270_CSTATE new_cstate) | @@ -703,22 +704,24 @@ void host_in3270(H3270 *session, LIB3270_CSTATE new_cstate) | ||
| 703 | lib3270_st_changed(session, LIB3270_STATE_3270_MODE, now3270); | 704 | lib3270_st_changed(session, LIB3270_STATE_3270_MODE, now3270); |
| 704 | } | 705 | } |
| 705 | 706 | ||
| 706 | -void host_connected(H3270 *session) | 707 | +void lib3270_set_connected(H3270 *hSession) |
| 707 | { | 708 | { |
| 708 | - session->cstate = CONNECTED_INITIAL; | ||
| 709 | - lib3270_st_changed(session, LIB3270_STATE_CONNECT, True); | ||
| 710 | - if(session->update_connect) | ||
| 711 | - session->update_connect(session,1); | 709 | + hSession->cstate = CONNECTED_INITIAL; |
| 710 | + lib3270_st_changed(hSession, LIB3270_STATE_CONNECT, True); | ||
| 711 | + if(hSession->update_connect) | ||
| 712 | + hSession->update_connect(hSession,1); | ||
| 712 | } | 713 | } |
| 713 | 714 | ||
| 714 | -void host_disconnected(H3270 *session) | 715 | +void lib3270_set_disconnected(H3270 *hSession) |
| 715 | { | 716 | { |
| 716 | - session->cstate = NOT_CONNECTED; | ||
| 717 | - set_status(session,OIA_FLAG_UNDERA,False); | ||
| 718 | - lib3270_st_changed(session,LIB3270_STATE_CONNECT, False); | ||
| 719 | - status_changed(session,LIB3270_MESSAGE_DISCONNECTED); | ||
| 720 | - if(session->update_connect) | ||
| 721 | - session->update_connect(session,0); | 717 | + CHECK_SESSION_HANDLE(hSession); |
| 718 | + | ||
| 719 | + hSession->cstate = NOT_CONNECTED; | ||
| 720 | + set_status(hSession,OIA_FLAG_UNDERA,False); | ||
| 721 | + lib3270_st_changed(hSession,LIB3270_STATE_CONNECT, False); | ||
| 722 | + status_changed(hSession,LIB3270_MESSAGE_DISCONNECTED); | ||
| 723 | + if(hSession->update_connect) | ||
| 724 | + hSession->update_connect(hSession,0); | ||
| 722 | } | 725 | } |
| 723 | 726 | ||
| 724 | /* Register a function interested in a state change. */ | 727 | /* Register a function interested in a state change. */ |
hostc.h
| @@ -39,8 +39,6 @@ | @@ -39,8 +39,6 @@ | ||
| 39 | // #define st_changed(tx,mode) lib3270_st_changed(NULL,tx,mode) | 39 | // #define st_changed(tx,mode) lib3270_st_changed(NULL,tx,mode) |
| 40 | 40 | ||
| 41 | LIB3270_INTERNAL void lib3270_st_changed(H3270 *h, LIB3270_STATE tx, int mode); | 41 | LIB3270_INTERNAL void lib3270_st_changed(H3270 *h, LIB3270_STATE tx, int mode); |
| 42 | - LIB3270_INTERNAL void host_connected(H3270 *session); | ||
| 43 | - LIB3270_INTERNAL void host_disconnected(H3270 *session); | ||
| 44 | LIB3270_INTERNAL void host_in3270(H3270 *session, LIB3270_CSTATE); | 42 | LIB3270_INTERNAL void host_in3270(H3270 *session, LIB3270_CSTATE); |
| 45 | LIB3270_INTERNAL void host_disconnect(H3270 *h, int disable); | 43 | LIB3270_INTERNAL void host_disconnect(H3270 *h, int disable); |
| 46 | 44 |
telnet.c
| @@ -867,7 +867,7 @@ static void net_connected(H3270 *session) | @@ -867,7 +867,7 @@ static void net_connected(H3270 *session) | ||
| 867 | // trace_dsn("TLS/SSL tunneled connection complete. Connection is now secure.\n"); | 867 | // trace_dsn("TLS/SSL tunneled connection complete. Connection is now secure.\n"); |
| 868 | 868 | ||
| 869 | /* Tell everyone else again. */ | 869 | /* Tell everyone else again. */ |
| 870 | - host_connected(session); | 870 | + lib3270_set_connected(session); |
| 871 | } | 871 | } |
| 872 | #endif /*]*/ | 872 | #endif /*]*/ |
| 873 | 873 | ||
| @@ -927,7 +927,7 @@ static void connection_complete(H3270 *session) | @@ -927,7 +927,7 @@ static void connection_complete(H3270 *session) | ||
| 927 | host_disconnect(session,True); | 927 | host_disconnect(session,True); |
| 928 | return; | 928 | return; |
| 929 | } | 929 | } |
| 930 | - host_connected(session); | 930 | + lib3270_set_connected(session); |
| 931 | net_connected(session); | 931 | net_connected(session); |
| 932 | } | 932 | } |
| 933 | 933 | ||
| @@ -1098,7 +1098,7 @@ void net_input(H3270 *session) | @@ -1098,7 +1098,7 @@ void net_input(H3270 *session) | ||
| 1098 | host_disconnect(session,True); | 1098 | host_disconnect(session,True); |
| 1099 | return; | 1099 | return; |
| 1100 | } | 1100 | } |
| 1101 | - host_connected(session); | 1101 | + lib3270_set_connected(session); |
| 1102 | net_connected(session); | 1102 | net_connected(session); |
| 1103 | } | 1103 | } |
| 1104 | 1104 | ||
| @@ -3396,7 +3396,7 @@ static void continue_tls(unsigned char *sbbuf, int len) | @@ -3396,7 +3396,7 @@ static void continue_tls(unsigned char *sbbuf, int len) | ||
| 3396 | // trace_dsn("TLS/SSL negotiated connection complete. Connection is now secure.\n"); | 3396 | // trace_dsn("TLS/SSL negotiated connection complete. Connection is now secure.\n"); |
| 3397 | 3397 | ||
| 3398 | /* Tell the world that we are (still) connected, now in secure mode. */ | 3398 | /* Tell the world that we are (still) connected, now in secure mode. */ |
| 3399 | - host_connected(&h3270); | 3399 | + lib3270_set_connected(&h3270); |
| 3400 | } | 3400 | } |
| 3401 | 3401 | ||
| 3402 | #endif /*]*/ | 3402 | #endif /*]*/ |