Lines Matching refs:conn_io
58 struct conn_io *h;
61 struct conn_io { struct
86 static void flush_egress(struct ev_loop *loop, struct conn_io *conn_io) { in flush_egress() argument
90 ssize_t written = quiche_conn_send(conn_io->conn, out, sizeof(out)); in flush_egress()
102 ssize_t sent = sendto(conn_io->sock, out, written, 0, in flush_egress()
103 (struct sockaddr *) &conn_io->peer_addr, in flush_egress()
104 conn_io->peer_addr_len); in flush_egress()
113 double t = quiche_conn_timeout_as_nanos(conn_io->conn) / 1e9f; in flush_egress()
114 conn_io->timer.repeat = t; in flush_egress()
115 ev_timer_again(loop, &conn_io->timer); in flush_egress()
172 static struct conn_io *create_conn(uint8_t *dcid, size_t dcid_len, uint8_t *odcid, in create_conn()
174 struct conn_io *conn_io = malloc(sizeof(*conn_io)); in create_conn() local
175 if (conn_io == NULL) { in create_conn()
180 memcpy(conn_io->cid, dcid, LOCAL_CONN_ID_LEN); in create_conn()
182 quiche_conn *conn = quiche_accept(conn_io->cid, LOCAL_CONN_ID_LEN, in create_conn()
189 conn_io->sock = conns->sock; in create_conn()
190 conn_io->conn = conn; in create_conn()
192 ev_init(&conn_io->timer, timeout_cb); in create_conn()
193 conn_io->timer.data = conn_io; in create_conn()
195 HASH_ADD(hh, conns->h, cid, LOCAL_CONN_ID_LEN, conn_io); in create_conn()
199 return conn_io; in create_conn()
203 struct conn_io *tmp, *conn_io = NULL; in recv_cb() local
250 HASH_FIND(hh, conns->h, dcid, dcid_len, conn_io); in recv_cb()
252 if (conn_io == NULL) { in recv_cb()
321 conn_io = create_conn(dcid, dcid_len, odcid, odcid_len); in recv_cb()
322 if (conn_io == NULL) { in recv_cb()
326 memcpy(&conn_io->peer_addr, &peer_addr, peer_addr_len); in recv_cb()
327 conn_io->peer_addr_len = peer_addr_len; in recv_cb()
330 ssize_t done = quiche_conn_recv(conn_io->conn, buf, read); in recv_cb()
339 if (quiche_conn_is_established(conn_io->conn)) { in recv_cb()
342 quiche_stream_iter *readable = quiche_conn_readable(conn_io->conn); in recv_cb()
348 ssize_t recv_len = quiche_conn_stream_recv(conn_io->conn, s, in recv_cb()
357 quiche_conn_stream_send(conn_io->conn, s, (uint8_t *) resp, in recv_cb()
366 HASH_ITER(hh, conns->h, conn_io, tmp) { in recv_cb()
367 flush_egress(loop, conn_io); in recv_cb()
369 if (quiche_conn_is_closed(conn_io->conn)) { in recv_cb()
372 quiche_conn_stats(conn_io->conn, &stats); in recv_cb()
376 HASH_DELETE(hh, conns->h, conn_io); in recv_cb()
378 ev_timer_stop(loop, &conn_io->timer); in recv_cb()
379 quiche_conn_free(conn_io->conn); in recv_cb()
380 free(conn_io); in recv_cb()
386 struct conn_io *conn_io = w->data; in timeout_cb() local
387 quiche_conn_on_timeout(conn_io->conn); in timeout_cb()
391 flush_egress(loop, conn_io); in timeout_cb()
393 if (quiche_conn_is_closed(conn_io->conn)) { in timeout_cb()
396 quiche_conn_stats(conn_io->conn, &stats); in timeout_cb()
400 HASH_DELETE(hh, conns->h, conn_io); in timeout_cb()
402 ev_timer_stop(loop, &conn_io->timer); in timeout_cb()
403 quiche_conn_free(conn_io->conn); in timeout_cb()
404 free(conn_io); in timeout_cb()