Commit 747869dd60dd924030a3c9c65a29cdae002a2956
1 parent
e5fc82f4
Exists in
master
and in
5 other branches
Removendo variavel duplicada
Showing
5 changed files
with
24 additions
and
23 deletions
Show diff stats
src/include/lib3270/session.h
src/lib3270/host.c
| ... | ... | @@ -546,9 +546,8 @@ static int do_connect(H3270 *hSession, const char *n) |
| 546 | 546 | |
| 547 | 547 | /* Attempt contact. */ |
| 548 | 548 | hSession->ever_3270 = False; |
| 549 | - hSession->net_sock = net_connect(hSession, chost, port, 0, &resolving,&pending); | |
| 550 | 549 | |
| 551 | - if (hSession->net_sock < 0 && !resolving) | |
| 550 | + if(net_connect(hSession, chost, port, 0, &resolving,&pending) < 0 && !resolving) | |
| 552 | 551 | { |
| 553 | 552 | /* Redundantly signal a disconnect. */ |
| 554 | 553 | host_disconnected(hSession); |
| ... | ... | @@ -573,7 +572,7 @@ static int do_connect(H3270 *hSession, const char *n) |
| 573 | 572 | // login_macro(ps); |
| 574 | 573 | |
| 575 | 574 | /* Prepare Xt for I/O. */ |
| 576 | - x_add_input(hSession,hSession->net_sock); | |
| 575 | + x_add_input(hSession,hSession->sock); | |
| 577 | 576 | |
| 578 | 577 | /* Set state and tell the world. */ |
| 579 | 578 | if (pending) |
| ... | ... | @@ -662,8 +661,7 @@ void host_disconnect(H3270 *h, int failed) |
| 662 | 661 | if (CONNECTED || HALF_CONNECTED) |
| 663 | 662 | { |
| 664 | 663 | x_remove_input(h); |
| 665 | - net_disconnect(); | |
| 666 | - h->net_sock = -1; | |
| 664 | + net_disconnect(h); | |
| 667 | 665 | |
| 668 | 666 | Trace("Disconnected (Failed: %d Reconnect: %d in_progress: %d)",failed,toggled(RECONNECT),h->auto_reconnect_inprogress); |
| 669 | 667 | if (toggled(RECONNECT) && !h->auto_reconnect_inprogress) | ... | ... |
src/lib3270/telnet.c
| ... | ... | @@ -913,33 +913,34 @@ static void output_possible(H3270 *session) |
| 913 | 913 | * net_disconnect |
| 914 | 914 | * Shut down the socket. |
| 915 | 915 | */ |
| 916 | -void net_disconnect(void) | |
| 916 | +void net_disconnect(H3270 *session) | |
| 917 | 917 | { |
| 918 | 918 | #if defined(HAVE_LIBSSL) |
| 919 | - if (h3270.ssl_con != NULL) | |
| 919 | + if(session->ssl_con != NULL) | |
| 920 | 920 | { |
| 921 | - SSL_shutdown(h3270.ssl_con); | |
| 922 | - SSL_free(h3270.ssl_con); | |
| 923 | - h3270.ssl_con = NULL; | |
| 921 | + SSL_shutdown(session->ssl_con); | |
| 922 | + SSL_free(session->ssl_con); | |
| 923 | + session->ssl_con = NULL; | |
| 924 | 924 | } |
| 925 | 925 | #endif |
| 926 | 926 | |
| 927 | - set_ssl_state(&h3270,LIB3270_SSL_UNSECURE); | |
| 928 | - | |
| 929 | - if (CONNECTED) | |
| 930 | - (void) shutdown(h3270.sock, 2); | |
| 927 | + set_ssl_state(session,LIB3270_SSL_UNSECURE); | |
| 931 | 928 | |
| 932 | - (void) SOCK_CLOSE(h3270.sock); | |
| 929 | + if(session->sock >= 0) | |
| 930 | + { | |
| 931 | + shutdown(session->sock, 2); | |
| 932 | + SOCK_CLOSE(session->sock); | |
| 933 | + session->sock = -1; | |
| 934 | + } | |
| 933 | 935 | |
| 934 | - h3270.sock = -1; | |
| 935 | 936 | trace_dsn("SENT disconnect\n"); |
| 936 | 937 | |
| 937 | 938 | /* Restore terminal type to its default. */ |
| 938 | 939 | if (appres.termname == CN) |
| 939 | - h3270.termtype = h3270.full_model_name; | |
| 940 | + session->termtype = session->full_model_name; | |
| 940 | 941 | |
| 941 | 942 | /* We're not connected to an LU any more. */ |
| 942 | - h3270.connected_lu = CN; | |
| 943 | + session->connected_lu = CN; | |
| 943 | 944 | status_lu(&h3270,CN); |
| 944 | 945 | |
| 945 | 946 | #if !defined(_WIN32) /*[*/ |
| ... | ... | @@ -3400,7 +3401,7 @@ static void continue_tls(unsigned char *sbbuf, int len) |
| 3400 | 3401 | /* Trace the junk. */ |
| 3401 | 3402 | trace_dsn("%s ? %s\n", opt(TELOPT_STARTTLS), cmd(SE)); |
| 3402 | 3403 | popup_an_error(NULL,"TLS negotiation failure"); |
| 3403 | - net_disconnect(); | |
| 3404 | + net_disconnect(&h3270); | |
| 3404 | 3405 | return; |
| 3405 | 3406 | } |
| 3406 | 3407 | |
| ... | ... | @@ -3412,7 +3413,7 @@ static void continue_tls(unsigned char *sbbuf, int len) |
| 3412 | 3413 | if(h3270.ssl_con == NULL) |
| 3413 | 3414 | { |
| 3414 | 3415 | /* Failed. */ |
| 3415 | - net_disconnect(); | |
| 3416 | + net_disconnect(&h3270); | |
| 3416 | 3417 | return; |
| 3417 | 3418 | } |
| 3418 | 3419 | |
| ... | ... | @@ -3438,7 +3439,7 @@ static void continue_tls(unsigned char *sbbuf, int len) |
| 3438 | 3439 | if (rv != 1) |
| 3439 | 3440 | { |
| 3440 | 3441 | trace_dsn("continue_tls: SSL_connect failed\n"); |
| 3441 | - net_disconnect(); | |
| 3442 | + net_disconnect(&h3270); | |
| 3442 | 3443 | return; |
| 3443 | 3444 | } |
| 3444 | 3445 | ... | ... |
src/lib3270/telnetc.h
| ... | ... | @@ -35,7 +35,7 @@ LIB3270_INTERNAL void net_add_eor(unsigned char *buf, int len); |
| 35 | 35 | LIB3270_INTERNAL void net_break(void); |
| 36 | 36 | LIB3270_INTERNAL void net_charmode(void); |
| 37 | 37 | LIB3270_INTERNAL int net_connect(H3270 *session, const char *, char *, Boolean, Boolean *, Boolean *); |
| 38 | -LIB3270_INTERNAL void net_disconnect(void); | |
| 38 | +LIB3270_INTERNAL void net_disconnect(H3270 *session); | |
| 39 | 39 | LIB3270_INTERNAL void net_exception(H3270 *session); |
| 40 | 40 | LIB3270_INTERNAL void net_hexansi_out(unsigned char *buf, int len); |
| 41 | 41 | LIB3270_INTERNAL void net_input(H3270 *session); | ... | ... |
src/pw3270/actions.c
| ... | ... | @@ -218,8 +218,10 @@ static void connect_standard_action(GtkAction *action, GtkWidget *widget, const |
| 218 | 218 | { "about", about_dialog_action }, |
| 219 | 219 | { "kpsubtract", kp_subtract_action }, |
| 220 | 220 | { "kpadd", kp_add_action }, |
| 221 | +#ifdef DEBUG | |
| 221 | 222 | { "download", download_action }, |
| 222 | 223 | { "upload", upload_action }, |
| 224 | +#endif // DEBUG | |
| 223 | 225 | }; |
| 224 | 226 | |
| 225 | 227 | int f; | ... | ... |