You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by sc...@apache.org on 2018/02/21 06:00:15 UTC
[trafficserver] branch quic-latest updated: QUIC: Sends stateless
reset packet if connection is closed
This is an automated email from the ASF dual-hosted git repository.
scw00 pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/quic-latest by this push:
new 11a3c6f QUIC: Sends stateless reset packet if connection is closed
11a3c6f is described below
commit 11a3c6f99bd3ef97ce406c0af62c1f23e59401cc
Author: scw00 <sc...@apache.org>
AuthorDate: Wed Feb 21 12:19:57 2018 +0800
QUIC: Sends stateless reset packet if connection is closed
---
iocore/net/QUICNetVConnection.cc | 44 ++++++++++++++++++++--------------------
iocore/net/QUICPacketHandler.cc | 34 +++++++++++++++++--------------
2 files changed, 41 insertions(+), 37 deletions(-)
diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index ac371e7..8ae5038 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -210,28 +210,28 @@ QUICNetVConnection::free(EThread *t)
this->_ctable->erase(this->_alt_quic_connection_ids[i].id, this);
}
-/* TODO: Uncmment these blocks after refactoring read / write process
- this->_udp_con = nullptr;
- this->_packet_handler = nullptr;
- _unschedule_packet_write_ready();
-
- delete this->_handshake_handler;
- delete this->_application_map;
- delete this->_crypto;
- delete this->_loss_detector;
- delete this->_frame_dispatcher;
- delete this->_stream_manager;
- delete this->_congestion_controller;
-
- // TODO: clear member variables like `UnixNetVConnection::free(EThread *t)`
- this->mutex.clear();
-
- if (from_accept_thread) {
- quicNetVCAllocator.free(this);
- } else {
- THREAD_FREE(this, quicNetVCAllocator, t);
- }
-*/
+ /* TODO: Uncmment these blocks after refactoring read / write process
+ this->_udp_con = nullptr;
+ this->_packet_handler = nullptr;
+ _unschedule_packet_write_ready();
+
+ delete this->_handshake_handler;
+ delete this->_application_map;
+ delete this->_crypto;
+ delete this->_loss_detector;
+ delete this->_frame_dispatcher;
+ delete this->_stream_manager;
+ delete this->_congestion_controller;
+
+ // TODO: clear member variables like `UnixNetVConnection::free(EThread *t)`
+ this->mutex.clear();
+
+ if (from_accept_thread) {
+ quicNetVCAllocator.free(this);
+ } else {
+ THREAD_FREE(this, quicNetVCAllocator, t);
+ }
+ */
}
void
diff --git a/iocore/net/QUICPacketHandler.cc b/iocore/net/QUICPacketHandler.cc
index 2f94cb8..0526a9c 100644
--- a/iocore/net/QUICPacketHandler.cc
+++ b/iocore/net/QUICPacketHandler.cc
@@ -177,25 +177,30 @@ QUICPacketHandlerIn::_recv_packet(int event, UDPPacket *udp_packet)
QUICConnection *qc =
this->_ctable.lookup(reinterpret_cast<const uint8_t *>(block->buf()), {udp_packet->from, udp_packet->to, SOCK_DGRAM});
- if (!qc) {
+ vc = static_cast<QUICNetVConnection *>(qc);
+ // 7.1. Matching Packets to Connections
+ // A server that discards a packet that cannot be associated with a connection MAY also generate a stateless reset
+ // Send stateless reset if the packet is not a initial packet or connection is closed.
+ if ((!vc && !QUICTypeUtil::has_long_header(reinterpret_cast<const uint8_t *>(block->buf()))) || (vc && vc->in_closed_queue)) {
Connection con;
con.setRemote(&udp_packet->from.sa);
-
- // Send stateless reset if the packet is not a initial packet
- if (!QUICTypeUtil::has_long_header(reinterpret_cast<const uint8_t *>(block->buf()))) {
- QUICConnectionId cid = this->_read_connection_id(block);
- QUICStatelessResetToken token;
- {
- QUICConfig::scoped_config params;
- token.generate(cid, params->server_id());
- }
- auto packet = QUICPacketFactory::create_stateless_reset_packet(cid, token);
- this->_send_packet(this, *packet, udp_packet->getConnection(), con.addr, 1200);
- return;
+ QUICConnectionId cid = this->_read_connection_id(block);
+ QUICStatelessResetToken token;
+ {
+ QUICConfig::scoped_config params;
+ token.generate(cid, params->server_id());
}
+ auto packet = QUICPacketFactory::create_stateless_reset_packet(cid, token);
+ this->_send_packet(this, *packet, udp_packet->getConnection(), con.addr, 1200);
+ udp_packet->free();
+ return;
+ }
- eth = eventProcessor.assign_thread(ET_NET);
+ if (!vc) {
+ Connection con;
+ con.setRemote(&udp_packet->from.sa);
+ eth = eventProcessor.assign_thread(ET_NET);
// Create a new NetVConnection
QUICConnectionId original_cid = this->_read_connection_id(block);
vc = static_cast<QUICNetVConnection *>(getNetProcessor()->allocate_vc(nullptr));
@@ -215,7 +220,6 @@ QUICPacketHandlerIn::_recv_packet(int event, UDPPacket *udp_packet)
qc = vc;
} else {
- vc = static_cast<QUICNetVConnection *>(qc);
eth = vc->thread;
}
--
To stop receiving notification emails like this one, please contact
scw00@apache.org.