nghttpx: Tweak close wait handling

This commit is contained in:
Tatsuhiro Tsujikawa 2021-09-15 23:07:46 +09:00
parent e2e6d827c7
commit 684a219e39
1 changed files with 25 additions and 13 deletions

View File

@ -93,13 +93,34 @@ int QUICConnectionHandler::handle_packet(const UpstreamAddr *faddr,
auto &quicconf = config->quic;
auto it = connections_.find(dcid_key);
if ((data[0] & 0x80) && it == std::end(connections_)) {
if (it == std::end(connections_)) {
auto cwit = close_waits_.find(dcid_key);
if (cwit != std::end(close_waits_)) {
auto cw = (*cwit).second;
cw->handle_packet(faddr, remote_addr, local_addr, data, datalen);
return 0;
}
if (data[0] & 0x80) {
if (generate_quic_hashed_connection_id(dcid_key, remote_addr, local_addr,
dcid_key) != 0) {
return 0;
}
it = connections_.find(dcid_key);
if (it == std::end(connections_)) {
auto cwit = close_waits_.find(dcid_key);
if (cwit != std::end(close_waits_)) {
auto cw = (*cwit).second;
cw->handle_packet(faddr, remote_addr, local_addr, data, datalen);
return 0;
}
}
}
}
if (it == std::end(connections_)) {
@ -129,15 +150,6 @@ int QUICConnectionHandler::handle_packet(const UpstreamAddr *faddr,
}
}
auto it = close_waits_.find(dcid_key);
if (it != std::end(close_waits_)) {
auto cw = (*it).second;
cw->handle_packet(faddr, remote_addr, local_addr, data, datalen);
return 0;
}
// new connection
auto &upstreamconf = config->conn.upstream;