MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / ssl_connect_or_accept_nonblocking

Function ssl_connect_or_accept_nonblocking

examples/server/httplib.h:7654–7673  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7652
7653template <typename U>
7654bool ssl_connect_or_accept_nonblocking(socket_t sock, SSL *ssl,
7655 U ssl_connect_or_accept,
7656 time_t timeout_sec,
7657 time_t timeout_usec) {
7658 int res = 0;
7659 while ((res = ssl_connect_or_accept(ssl)) != 1) {
7660 auto err = SSL_get_error(ssl, res);
7661 switch (err) {
7662 case SSL_ERROR_WANT_READ:
7663 if (select_read(sock, timeout_sec, timeout_usec) > 0) { continue; }
7664 break;
7665 case SSL_ERROR_WANT_WRITE:
7666 if (select_write(sock, timeout_sec, timeout_usec) > 0) { continue; }
7667 break;
7668 default: break;
7669 }
7670 return false;
7671 }
7672 return true;
7673}
7674
7675template <typename T>
7676inline bool process_server_socket_ssl(

Callers 2

initialize_sslMethod · 0.85

Calls 2

select_readFunction · 0.85
select_writeFunction · 0.85

Tested by

no test coverage detected