wolfssl-examples icon indicating copy to clipboard operation
wolfssl-examples copied to clipboard

fixing select usage

Open kojo1 opened this issue 4 years ago • 0 comments

  • Set timeout in tcp_select timeout.tv_sec = to_sec;

  • Set non-blocking to "connd", as well. fcntl(connd, F_SETFL, O_NONBLOCK)

  • tcp_select(connd,...) for wolfSSL_accept, read, write

  • make all 3 args non-NULL for select. NULL arg derives error on MacOS.

====

Totally changed to a single polling point.

SV_CTX *sv_poll() {
        poll();
        return next_ctx;
}

int main() {
    while(1) {
        switch (sv_main(sv_ctx = sv_poll())) {
        case NB_CONTINUE:
            break;
    }
}

kojo1 avatar Jan 17 '22 23:01 kojo1