Commit c15748bc7a608ef307b525bd4ffceab06ab4b1ba

Authored by perry.werneck@gmail.com
1 parent 031f3088

Melhorando compatibilidade com a libwebsockets

Showing 2 changed files with 39 additions and 2 deletions   Show diff stats
src/include/lib3270.h
... ... @@ -670,8 +670,8 @@
670 670 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 );
671 671 LIB3270_EXPORT void lib3270_remove_poll(void *id);
672 672  
673   -// LIB3270_EXPORT void lib3270_remove_poll_fd(int fd);
674   -// LIB3270_EXPORT void lib3270_update_poll_fd(int fd, LIB3270_IO_FLAG flag);
  673 + LIB3270_EXPORT void lib3270_remove_poll_fd(int fd);
  674 + LIB3270_EXPORT void lib3270_update_poll_fd(int fd, LIB3270_IO_FLAG flag);
675 675  
676 676 /** Callback table
677 677 *
... ...
src/lib3270/iocalls.c
... ... @@ -285,6 +285,43 @@ LIB3270_EXPORT void lib3270_remove_poll(void *id) {
285 285 remove_poll(id);
286 286 }
287 287  
  288 +LIB3270_EXPORT void lib3270_remove_poll_fd(int fd)
  289 +{
  290 +
  291 + input_t *ip;
  292 +
  293 + for (ip = inputs; ip != (input_t *)NULL; ip = ip->next)
  294 + {
  295 + if(ip->fd == fd)
  296 + {
  297 + remove_poll(ip);
  298 + return;
  299 + }
  300 + }
  301 +
  302 + lib3270_write_log(NULL,"iocalls","Invalid or unexpected FD on %s(%d)",__FUNCTION__,fd);
  303 +
  304 +}
  305 +
  306 +LIB3270_EXPORT void lib3270_update_poll_fd(int fd, LIB3270_IO_FLAG flag)
  307 +{
  308 +
  309 + input_t *ip;
  310 +
  311 + for (ip = inputs; ip != (input_t *)NULL; ip = ip->next)
  312 + {
  313 + if(ip->fd == fd)
  314 + {
  315 + ip->flag = flag;
  316 + return;
  317 + }
  318 + }
  319 +
  320 + lib3270_write_log(NULL,"iocalls","Invalid or unexpected FD on %s(%d)",__FUNCTION__,fd);
  321 +
  322 +}
  323 +
  324 +
288 325 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 ) {
289 326 return add_poll(session,fd,flag,call,userdata);
290 327 }
... ...