diff --git a/src/shrpx_http3_upstream.cc b/src/shrpx_http3_upstream.cc index da080c0a..92a8aad6 100644 --- a/src/shrpx_http3_upstream.cc +++ b/src/shrpx_http3_upstream.cc @@ -638,6 +638,7 @@ int Http3Upstream::write_streams() { bufpos += nwrite; +#ifdef UDP_SEGMENT if (pktcnt == 0) { ngtcp2_path_copy(&prev_ps.path, &ps.path); } else if (!ngtcp2_path_eq(&prev_ps.path, &ps.path)) { @@ -674,6 +675,23 @@ int Http3Upstream::write_streams() { return 0; } +#else // !UDP_SEGMENT + quic_send_packet(static_cast(ps.path.user_data), + ps.path.remote.addr, ps.path.remote.addrlen, + ps.path.local.addr, ps.path.local.addrlen, buf.data(), + bufpos - buf.data(), 0); + + if (++pktcnt == max_pktcnt) { + ngtcp2_conn_update_pkt_tx_time(conn_, ts); + reset_idle_timer(); + + handler_->signal_write(); + + return 0; + } + + bufpos = buf.data(); +#endif // !UDP_SEGMENT } return 0; diff --git a/src/shrpx_quic.cc b/src/shrpx_quic.cc index 09f0683f..a1ea2a32 100644 --- a/src/shrpx_quic.cc +++ b/src/shrpx_quic.cc @@ -210,8 +210,11 @@ int quic_send_packet(const UpstreamAddr *faddr, const sockaddr *remote_sa, msg.msg_iov = &msg_iov; msg.msg_iovlen = 1; - uint8_t - msg_ctrl[CMSG_SPACE(sizeof(uint16_t)) + CMSG_SPACE(sizeof(in6_pktinfo))]; + uint8_t msg_ctrl[ +#ifdef UDP_SEGMENT + CMSG_SPACE(sizeof(uint16_t)) + +#endif // UDP_SEGMENT + CMSG_SPACE(sizeof(in6_pktinfo))]; memset(msg_ctrl, 0, sizeof(msg_ctrl)); @@ -251,6 +254,7 @@ int quic_send_packet(const UpstreamAddr *faddr, const sockaddr *remote_sa, assert(0); } +#ifdef UDP_SEGMENT if (gso_size && datalen > gso_size) { controllen += CMSG_SPACE(sizeof(uint16_t)); cm = CMSG_NXTHDR(&msg, cm); @@ -259,6 +263,7 @@ int quic_send_packet(const UpstreamAddr *faddr, const sockaddr *remote_sa, cm->cmsg_len = CMSG_LEN(sizeof(uint16_t)); *(reinterpret_cast(CMSG_DATA(cm))) = gso_size; } +#endif // UDP_SEGMENT msg.msg_controllen = controllen;