Commit 6739b90c5659dd8bcbe400c1535940e819a3ab4f
1 parent
0a3c2fcb
Exists in
master
and in
3 other branches
Igualando connect windows/linux, ferramentas devem ser compiladas com o compilad…
…or do host, não com o cross
Showing
1 changed file
with
32 additions
and
18 deletions
Show diff stats
telnet.c
| ... | ... | @@ -331,9 +331,9 @@ static void ssl_info_callback(INFO_CONST SSL *s, int where, int ret); |
| 331 | 331 | static void continue_tls(unsigned char *sbbuf, int len); |
| 332 | 332 | #endif /*]*/ |
| 333 | 333 | |
| 334 | -#if !defined(_WIN32) /*[*/ | |
| 335 | -static void output_possible(H3270 *session); | |
| 336 | -#endif /*]*/ | |
| 334 | +// #if !defined(_WIN32) /*[*/ | |
| 335 | +// static void output_possible(H3270 *session); | |
| 336 | +// #endif /*]*/ | |
| 337 | 337 | |
| 338 | 338 | #if defined(_WIN32) /*[*/ |
| 339 | 339 | #define socket_errno() WSAGetLastError() |
| ... | ... | @@ -624,7 +624,7 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo |
| 624 | 624 | #endif |
| 625 | 625 | |
| 626 | 626 | /* set the socket to be non-delaying */ |
| 627 | - if (non_blocking(session,True) < 0) | |
| 627 | + if (non_blocking(session,False) < 0) | |
| 628 | 628 | close_fail; |
| 629 | 629 | |
| 630 | 630 | #if !defined(_WIN32) |
| ... | ... | @@ -641,17 +641,19 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo |
| 641 | 641 | |
| 642 | 642 | /* connect */ |
| 643 | 643 | status_connecting(session,1); |
| 644 | + rc = connect_sock(session, session->sock, &haddr.sa,ha_len); | |
| 644 | 645 | |
| 645 | - switch(connect_sock(session, session->sock, &haddr.sa,ha_len)) | |
| 646 | + if(!rc) | |
| 646 | 647 | { |
| 647 | - case 0: // Connected | |
| 648 | 648 | trace_dsn("Connected.\n"); |
| 649 | 649 | |
| 650 | - if(non_blocking(session,False) < 0) | |
| 651 | - close_fail; | |
| 650 | +// if(non_blocking(session,False) < 0) | |
| 651 | +// close_fail; | |
| 652 | + | |
| 652 | 653 | net_connected(session); |
| 653 | - break; | |
| 654 | 654 | |
| 655 | +/* | |
| 656 | + break; | |
| 655 | 657 | case SE_EWOULDBLOCK: // Connection in progress |
| 656 | 658 | case SE_EINPROGRESS: |
| 657 | 659 | *pending = True; |
| ... | ... | @@ -660,9 +662,19 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo |
| 660 | 662 | output_id = AddOutput(session->sock, session, output_possible); |
| 661 | 663 | #endif |
| 662 | 664 | break; |
| 665 | +*/ | |
| 666 | + } | |
| 667 | + else | |
| 668 | + { | |
| 669 | + char *msg = xs_buffer( _( "Can't connect to %s:%d" ), session->hostname, session->current_port); | |
| 663 | 670 | |
| 664 | - default: | |
| 665 | - popup_a_sockerr(session, N_( "Can't connect to %s:%d" ),session->hostname, session->current_port); | |
| 671 | + lib3270_popup_dialog( session, | |
| 672 | + LIB3270_NOTIFY_ERROR, | |
| 673 | + _( "Network error" ), | |
| 674 | + msg, | |
| 675 | + "%s",strerror(rc) ); | |
| 676 | + | |
| 677 | + Free(msg); | |
| 666 | 678 | close_fail; |
| 667 | 679 | |
| 668 | 680 | } |
| ... | ... | @@ -801,7 +813,7 @@ static void net_connected(H3270 *session) |
| 801 | 813 | } |
| 802 | 814 | else |
| 803 | 815 | { |
| 804 | - non_blocking(session,False); | |
| 816 | + // non_blocking(session,False); | |
| 805 | 817 | rc = SSL_connect(session->ssl_con); |
| 806 | 818 | |
| 807 | 819 | if(rc != 1) |
| ... | ... | @@ -898,12 +910,13 @@ static void connection_complete(void) |
| 898 | 910 | net_connected(&h3270); |
| 899 | 911 | } |
| 900 | 912 | |
| 901 | -#if !defined(_WIN32) /*[*/ | |
| 902 | 913 | /* |
| 903 | - * output_possible | |
| 904 | - * Output is possible on the socket. Used only when a connection is | |
| 905 | - * pending, to determine that the connection is complete. | |
| 906 | - */ | |
| 914 | +#if !defined(_WIN32) | |
| 915 | +// | |
| 916 | +// output_possible | |
| 917 | +// Output is possible on the socket. Used only when a connection is | |
| 918 | +// pending, to determine that the connection is complete. | |
| 919 | +// | |
| 907 | 920 | static void output_possible(H3270 *session) |
| 908 | 921 | { |
| 909 | 922 | trace("%s: %s",__FUNCTION__,HALF_CONNECTED ? "Half connected" : "Connected"); |
| ... | ... | @@ -918,7 +931,8 @@ static void output_possible(H3270 *session) |
| 918 | 931 | output_id = 0L; |
| 919 | 932 | } |
| 920 | 933 | } |
| 921 | -#endif /*]*/ | |
| 934 | +#endif | |
| 935 | +*/ | |
| 922 | 936 | |
| 923 | 937 | /* |
| 924 | 938 | * net_disconnect | ... | ... |