Commit 85a9cb317f700294b745ded07f6cfeef8636dfab

Authored by perry.werneck@gmail.com
1 parent 5372b5eb

Melhorando controles

Showing 3 changed files with 8 additions and 20 deletions   Show diff stats
@@ -82,7 +82,7 @@ static void net_connected(H3270 *hSession, int fd, LIB3270_IO_FLAG flag, void *d @@ -82,7 +82,7 @@ static void net_connected(H3270 *hSession, int fd, LIB3270_IO_FLAG flag, void *d
82 int err; 82 int err;
83 socklen_t len = sizeof(err); 83 socklen_t len = sizeof(err);
84 84
85 - trace("%s",__FUNCTION__); 85 + trace("%s write=%p",__FUNCTION__,hSession->ns_write_id);
86 lib3270_remove_poll(hSession->ns_write_id); 86 lib3270_remove_poll(hSession->ns_write_id);
87 hSession->ns_write_id = NULL; 87 hSession->ns_write_id = NULL;
88 88
@@ -121,15 +121,9 @@ static void net_connected(H3270 *hSession, int fd, LIB3270_IO_FLAG flag, void *d @@ -121,15 +121,9 @@ static void net_connected(H3270 *hSession, int fd, LIB3270_IO_FLAG flag, void *d
121 return; 121 return;
122 } 122 }
123 123
124 -// hSession->ns_exception_id = AddExcept(hSession->sock, hSession, net_exception);  
125 -// hSession->ns_read_id = AddInput(hSession->sock, hSession, net_input);  
126 -  
127 hSession->ns_exception_id = lib3270_add_poll_fd(hSession,hSession->sock,LIB3270_IO_FLAG_EXCEPTION,net_exception,0); 124 hSession->ns_exception_id = lib3270_add_poll_fd(hSession,hSession->sock,LIB3270_IO_FLAG_EXCEPTION,net_exception,0);
128 hSession->ns_read_id = lib3270_add_poll_fd(hSession,hSession->sock,LIB3270_IO_FLAG_READ,net_input,0); 125 hSession->ns_read_id = lib3270_add_poll_fd(hSession,hSession->sock,LIB3270_IO_FLAG_READ,net_input,0);
129 126
130 - hSession->excepting = 1;  
131 - hSession->reading = 1;  
132 -  
133 #if defined(HAVE_LIBSSL) 127 #if defined(HAVE_LIBSSL)
134 if(hSession->ssl_con && hSession->secure == LIB3270_SSL_UNDEFINED) 128 if(hSession->ssl_con && hSession->secure == LIB3270_SSL_UNDEFINED)
135 { 129 {
@@ -273,6 +273,7 @@ static void internal_remove_poll(void *id) @@ -273,6 +273,7 @@ static void internal_remove_poll(void *id)
273 } 273 }
274 274
275 LIB3270_EXPORT void lib3270_remove_poll(void *id) { 275 LIB3270_EXPORT void lib3270_remove_poll(void *id) {
  276 + debug("%s %p",__FUNCTION__,id);
276 remove_poll(id); 277 remove_poll(id);
277 } 278 }
278 279
@@ -312,7 +313,6 @@ LIB3270_EXPORT void lib3270_update_poll_fd(int fd, LIB3270_IO_FLAG flag) @@ -312,7 +313,6 @@ LIB3270_EXPORT void lib3270_update_poll_fd(int fd, LIB3270_IO_FLAG flag)
312 313
313 } 314 }
314 315
315 -  
316 LIB3270_EXPORT void * lib3270_add_poll_fd(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*call)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata ) { 316 LIB3270_EXPORT void * lib3270_add_poll_fd(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*call)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata ) {
317 return add_poll(session,fd,flag,call,userdata); 317 return add_poll(session,fd,flag,call,userdata);
318 } 318 }
@@ -626,21 +626,19 @@ void RemoveTimeOut(void * timer) @@ -626,21 +626,19 @@ void RemoveTimeOut(void * timer)
626 626
627 void x_except_on(H3270 *h) 627 void x_except_on(H3270 *h)
628 { 628 {
629 - if(h->excepting) 629 + int reading = (h->ns_read_id != NULL);
  630 +
  631 + if(h->ns_exception_id)
630 return; 632 return;
631 633
632 - if(h->reading) 634 + if(reading)
633 lib3270_remove_poll(h->ns_read_id); 635 lib3270_remove_poll(h->ns_read_id);
634 636
635 h->ns_exception_id = lib3270_add_poll_fd(h,h->sock,LIB3270_IO_FLAG_EXCEPTION,net_exception,0); 637 h->ns_exception_id = lib3270_add_poll_fd(h,h->sock,LIB3270_IO_FLAG_EXCEPTION,net_exception,0);
636 -// h->ns_exception_id = AddExcept(h->sock, h, net_exception);  
637 -  
638 - h->excepting = 1;  
639 638
640 - if(h->reading) 639 + if(reading)
641 h->ns_read_id = lib3270_add_poll_fd(h,h->sock,LIB3270_IO_FLAG_READ,net_input,0); 640 h->ns_read_id = lib3270_add_poll_fd(h,h->sock,LIB3270_IO_FLAG_READ,net_input,0);
642 641
643 -// h->ns_read_id = AddInput(h->sock, h, net_input);  
644 } 642 }
645 643
646 void remove_input_calls(H3270 *session) 644 void remove_input_calls(H3270 *session)
@@ -649,19 +647,16 @@ void remove_input_calls(H3270 *session) @@ -649,19 +647,16 @@ void remove_input_calls(H3270 *session)
649 { 647 {
650 lib3270_remove_poll(session->ns_read_id); 648 lib3270_remove_poll(session->ns_read_id);
651 session->ns_read_id = NULL; 649 session->ns_read_id = NULL;
652 - session->reading = 0;  
653 } 650 }
654 if(session->ns_exception_id) 651 if(session->ns_exception_id)
655 { 652 {
656 lib3270_remove_poll(session->ns_exception_id); 653 lib3270_remove_poll(session->ns_exception_id);
657 session->ns_exception_id = NULL; 654 session->ns_exception_id = NULL;
658 - session->excepting = 0;  
659 } 655 }
660 if(session->ns_write_id) 656 if(session->ns_write_id)
661 { 657 {
662 lib3270_remove_poll(session->ns_write_id); 658 lib3270_remove_poll(session->ns_write_id);
663 session->ns_write_id = NULL; 659 session->ns_write_id = NULL;
664 - session->writing = 0;  
665 } 660 }
666 } 661 }
667 662
@@ -1959,11 +1959,10 @@ void net_exception(H3270 *session, int fd, LIB3270_IO_FLAG flag, void *dunno) @@ -1959,11 +1959,10 @@ void net_exception(H3270 *session, int fd, LIB3270_IO_FLAG flag, void *dunno)
1959 { 1959 {
1960 session->syncing = 1; 1960 session->syncing = 1;
1961 1961
1962 - if(session->excepting) 1962 + if(session->ns_exception_id)
1963 { 1963 {
1964 lib3270_remove_poll(session->ns_exception_id); 1964 lib3270_remove_poll(session->ns_exception_id);
1965 session->ns_exception_id = NULL; 1965 session->ns_exception_id = NULL;
1966 - session->excepting = 0;  
1967 } 1966 }
1968 } 1967 }
1969 } 1968 }