Commit b7c1b11c05f51326df5c7b509bcf868a4a9ccba0

Authored by perry.werneck@gmail.com
1 parent bb4e13f2

Melhorando controles

src/include/lib3270/session.h
... ... @@ -375,9 +375,9 @@
375 375 void * ns_write_id;
376 376 void * ns_exception_id;
377 377  
378   - int reading : 1;
379   - int writing : 1;
380   - int excepting : 1;
  378 +// int reading : 1;
  379 +// int writing : 1;
  380 +// int excepting : 1;
381 381  
382 382 // SSL Data (Always defined to mantain the same structure size)
383 383 unsigned long ssl_error;
... ...
src/lib3270/connect.c
... ... @@ -82,7 +82,7 @@ static void net_connected(H3270 *hSession, int fd, LIB3270_IO_FLAG flag, void *d
82 82 int err;
83 83 socklen_t len = sizeof(err);
84 84  
85   - trace("%s",__FUNCTION__);
  85 + trace("%s write=%p",__FUNCTION__,hSession->ns_write_id);
86 86 lib3270_remove_poll(hSession->ns_write_id);
87 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 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 124 hSession->ns_exception_id = lib3270_add_poll_fd(hSession,hSession->sock,LIB3270_IO_FLAG_EXCEPTION,net_exception,0);
128 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 127 #if defined(HAVE_LIBSSL)
134 128 if(hSession->ssl_con && hSession->secure == LIB3270_SSL_UNDEFINED)
135 129 {
... ...
src/lib3270/iocalls.c
... ... @@ -273,6 +273,7 @@ static void internal_remove_poll(void *id)
273 273 }
274 274  
275 275 LIB3270_EXPORT void lib3270_remove_poll(void *id) {
  276 + debug("%s %p",__FUNCTION__,id);
276 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 313  
313 314 }
314 315  
315   -
316 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 317 return add_poll(session,fd,flag,call,userdata);
318 318 }
... ... @@ -626,21 +626,19 @@ void RemoveTimeOut(void * timer)
626 626  
627 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 632 return;
631 633  
632   - if(h->reading)
  634 + if(reading)
633 635 lib3270_remove_poll(h->ns_read_id);
634 636  
635 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 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 644 void remove_input_calls(H3270 *session)
... ... @@ -649,19 +647,16 @@ void remove_input_calls(H3270 *session)
649 647 {
650 648 lib3270_remove_poll(session->ns_read_id);
651 649 session->ns_read_id = NULL;
652   - session->reading = 0;
653 650 }
654 651 if(session->ns_exception_id)
655 652 {
656 653 lib3270_remove_poll(session->ns_exception_id);
657 654 session->ns_exception_id = NULL;
658   - session->excepting = 0;
659 655 }
660 656 if(session->ns_write_id)
661 657 {
662 658 lib3270_remove_poll(session->ns_write_id);
663 659 session->ns_write_id = NULL;
664   - session->writing = 0;
665 660 }
666 661 }
667 662  
... ...
src/lib3270/telnet.c
... ... @@ -1959,11 +1959,10 @@ void net_exception(H3270 *session, int fd, LIB3270_IO_FLAG flag, void *dunno)
1959 1959 {
1960 1960 session->syncing = 1;
1961 1961  
1962   - if(session->excepting)
  1962 + if(session->ns_exception_id)
1963 1963 {
1964 1964 lib3270_remove_poll(session->ns_exception_id);
1965 1965 session->ns_exception_id = NULL;
1966   - session->excepting = 0;
1967 1966 }
1968 1967 }
1969 1968 }
... ...