convert_tcpls.c
/**
 * Only handle 1 read/write socket so far; we do not need more capability at the
 * moment
 */
Only handle 1 read/write socket so far; we do not need more capability at the
moment
Only handle 1 read / write socket so far ; we do not need more capability at the moment
static int tcpls_hold_data_to_read_or_write(fd_set *readfds, fd_set *writefds) {
  struct tcpls_con *con;
  int res = 0;
  if (tcpls_buf.off - tcpls_buf_read_offset > 0 && readfds) {
    for (int i = 0; i < tcpls_con_l->size; i++) {
      con = list_get(tcpls_con_l, i);
      if (FD_ISSET(con->sd, readfds)) {
        FD_ZERO(readfds);
        FD_SET(con->sd, readfds);
        res += 1;
        break;
      }
    }
  }
  if (writefds) {
    for (int i = 0; i < tcpls_con_l->size; i++) {
      con = list_get(tcpls_con_l, i);
      if (FD_ISSET(con->sd, writefds)) {
        FD_ZERO(writefds);
        FD_SET(con->sd, writefds);
        res += 1;
        break;
      }
    }
  }
  return res;
}
static int tcpls_hold_data_to_read_or_write ( fd_set * readfds , fd_set * writefds ) { struct tcpls_con * con ; int res = 0 ; if ( tcpls_buf . off - tcpls_buf_read_offset > 0 && readfds ) { for ( int i = 0 ; i < tcpls_con_l -> size ; i ++ ) { con = list_get ( tcpls_con_l , i ) ; if ( FD_ISSET ( con -> sd , readfds ) ) { FD_ZERO ( readfds ) ; FD_SET ( con -> sd , readfds ) ; res += 1 ; break ; } } } if ( writefds ) { for ( int i = 0 ; i < tcpls_con_l -> size ; i ++ ) { con = list_get ( tcpls_con_l , i ) ; if ( FD_ISSET ( con -> sd , writefds ) ) { FD_ZERO ( writefds ) ; FD_SET ( con -> sd , writefds ) ; res += 1 ; break ; } } } return res ; }
Only handle 1 read/write socket so far; we do not need more capability at the
 moment
Only handle 1 read / write socket so far ; we do not need more capability at the moment
/** check whether we have something to read */ /** check whether we have something to write */