Lines Matching refs:conn

63     APP_CONN *conn;  in new_conn()  local
71 conn = calloc(1, sizeof(APP_CONN)); in new_conn()
72 if (conn == NULL) in new_conn()
77 free(conn); in new_conn()
83 free(conn); in new_conn()
103 free(conn); in new_conn()
111 free(conn); in new_conn()
119 free(conn); in new_conn()
126 free(conn); in new_conn()
142 conn->ssl_bio = out; in new_conn()
143 return conn; in new_conn()
152 int tx(APP_CONN *conn, const void *buf, int buf_len) in tx() argument
156 conn->tx_need_rx = 0; in tx()
158 l = BIO_write(conn->ssl_bio, buf, buf_len); in tx()
160 if (BIO_should_retry(conn->ssl_bio)) { in tx()
161 conn->tx_need_rx = BIO_should_read(conn->ssl_bio); in tx()
177 int rx(APP_CONN *conn, void *buf, int buf_len) in rx() argument
181 conn->rx_need_tx = 0; in rx()
183 l = BIO_read(conn->ssl_bio, buf, buf_len); in rx()
185 if (BIO_should_retry(conn->ssl_bio)) { in rx()
186 conn->rx_need_tx = BIO_should_write(conn->ssl_bio); in rx()
200 int get_conn_fd(APP_CONN *conn) in get_conn_fd() argument
205 if (!BIO_get_rpoll_descriptor(conn->ssl_bio, &d)) in get_conn_fd()
210 return BIO_get_fd(conn->ssl_bio, NULL); in get_conn_fd()
227 int get_conn_pending_tx(APP_CONN *conn) in get_conn_pending_tx() argument
230 return (SSL_net_read_desired(conn->ssl) ? POLLIN : 0) in get_conn_pending_tx()
231 | (SSL_net_write_desired(conn->ssl) ? POLLOUT : 0) in get_conn_pending_tx()
234 return (conn->tx_need_rx ? POLLIN : 0) | POLLOUT | POLLERR; in get_conn_pending_tx()
238 int get_conn_pending_rx(APP_CONN *conn) in get_conn_pending_rx() argument
241 return get_conn_pending_tx(conn); in get_conn_pending_rx()
243 return (conn->rx_need_tx ? POLLOUT : 0) | POLLIN | POLLERR; in get_conn_pending_rx()
256 int get_conn_pump_timeout(APP_CONN *conn) in get_conn_pump_timeout() argument
261 if (!SSL_get_event_timeout(conn->ssl, &tv, &is_infinite)) in get_conn_pump_timeout()
271 void pump(APP_CONN *conn) in pump() argument
273 SSL_handle_events(conn->ssl); in pump()
281 void teardown(APP_CONN *conn) in teardown() argument
283 BIO_free_all(conn->ssl_bio); in teardown()
284 free(conn); in teardown()
325 APP_CONN *conn = NULL; in main() local
347 conn = new_conn(ctx, host_port); in main()
348 if (conn == NULL) { in main()
355 l = tx(conn, tx_p, tx_len); in main()
368 ms_to_timeval(&t, get_conn_pump_timeout(conn)); in main()
376 pfd.fd = get_conn_fd(conn); in main()
377 pfd.events = get_conn_pending_tx(conn); in main()
385 pump(conn); in main()
400 l = rx(conn, rx_buf, sizeof(rx_buf)); in main()
412 ms_to_timeval(&t, get_conn_pump_timeout(conn)); in main()
420 pfd.fd = get_conn_fd(conn); in main()
421 pfd.events = get_conn_pending_rx(conn); in main()
429 pump(conn); in main()
444 if (conn != NULL) in main()
445 teardown(conn); in main()