You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by cm...@apache.org on 2024/02/20 18:07:47 UTC
(trafficserver) branch 10.0.x updated (2956553c24 -> fbd2128515)
This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a change to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
from 2956553c24 ESI plugin: make maximum document size configurable. (#11076)
new e0878f3f0a http3: Separate out Http3SettingsFramer (#11082)
new fbd2128515 http3: Propagate events from QUICNetVC (#11071)
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
include/proxy/http3/Http3App.h | 16 ------
include/proxy/http3/Http3Session.h | 4 +-
.../{Http3DataFramer.h => Http3SettingsFramer.h} | 14 ++---
include/proxy/http3/Http3Transaction.h | 1 +
src/iocore/net/P_QUICNetVConnection.h | 2 +
src/iocore/net/QUICNetVConnection.cc | 26 +++++++--
src/proxy/http3/CMakeLists.txt | 1 +
src/proxy/http3/Http3App.cc | 46 +--------------
src/proxy/http3/Http3Session.cc | 40 +++++++------
src/proxy/http3/Http3SettingsFramer.cc | 67 ++++++++++++++++++++++
src/proxy/http3/Http3Transaction.cc | 14 +++++
11 files changed, 139 insertions(+), 92 deletions(-)
copy include/proxy/http3/{Http3DataFramer.h => Http3SettingsFramer.h} (75%)
create mode 100644 src/proxy/http3/Http3SettingsFramer.cc
(trafficserver) 02/02: http3: Propagate events from QUICNetVC (#11071)
Posted by cm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit fbd21285153c7a2814724bf2cb1cd8a0cde45cc3
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Fri Feb 16 17:04:13 2024 -0700
http3: Propagate events from QUICNetVC (#11071)
* http3: Propagate events from QUICNetVC
* Propagate events to HttpSM
(cherry picked from commit 9d26d12adf16a67d176aeb28c0e626bc10c68e6a)
---
include/proxy/http3/Http3Session.h | 4 ++--
include/proxy/http3/Http3Transaction.h | 1 +
src/iocore/net/P_QUICNetVConnection.h | 2 ++
src/iocore/net/QUICNetVConnection.cc | 26 ++++++++++++++++++----
src/proxy/http3/Http3Session.cc | 40 +++++++++++++++++++---------------
src/proxy/http3/Http3Transaction.cc | 14 ++++++++++++
6 files changed, 64 insertions(+), 23 deletions(-)
diff --git a/include/proxy/http3/Http3Session.h b/include/proxy/http3/Http3Session.h
index cfcb7e7f76..cc0d7c488b 100644
--- a/include/proxy/http3/Http3Session.h
+++ b/include/proxy/http3/Http3Session.h
@@ -37,8 +37,6 @@ public:
virtual ~HQSession();
// Implement VConnection interface
- VIO *do_io_read(Continuation *c, int64_t nbytes = INT64_MAX, MIOBuffer *buf = nullptr) override;
- VIO *do_io_write(Continuation *c = nullptr, int64_t nbytes = INT64_MAX, IOBufferReader *buf = 0, bool owner = false) override;
void do_io_close(int lerrno = -1) override;
void do_io_shutdown(ShutdownHowTo_t howto) override;
void reenable(VIO *vio) override;
@@ -63,6 +61,8 @@ private:
Queue<HQTransaction> _transaction_list;
char _protocol_string[16];
+
+ int main_event_handler(int, void *);
};
class Http3Session : public HQSession
diff --git a/include/proxy/http3/Http3Transaction.h b/include/proxy/http3/Http3Transaction.h
index 833fc39ae8..3db3ac1d6d 100644
--- a/include/proxy/http3/Http3Transaction.h
+++ b/include/proxy/http3/Http3Transaction.h
@@ -84,6 +84,7 @@ protected:
void _schedule_write_complete_event();
void _unschedule_write_complete_event();
void _close_write_complete_event(Event *e);
+ void _signal_event(int event);
void _signal_read_event();
void _signal_write_event();
void _delete_if_possible();
diff --git a/src/iocore/net/P_QUICNetVConnection.h b/src/iocore/net/P_QUICNetVConnection.h
index bef664de34..06a366b968 100644
--- a/src/iocore/net/P_QUICNetVConnection.h
+++ b/src/iocore/net/P_QUICNetVConnection.h
@@ -204,6 +204,8 @@ private:
void _handle_write_ready();
void _handle_interval();
+ void _propagate_event(int event);
+
void _switch_to_established_state();
bool _handshake_completed = false;
diff --git a/src/iocore/net/QUICNetVConnection.cc b/src/iocore/net/QUICNetVConnection.cc
index 8642b62637..bfd0421357 100644
--- a/src/iocore/net/QUICNetVConnection.cc
+++ b/src/iocore/net/QUICNetVConnection.cc
@@ -171,6 +171,7 @@ QUICNetVConnection::state_handshake(int event, Event *data)
case VC_EVENT_ACTIVE_TIMEOUT:
case VC_EVENT_INACTIVITY_TIMEOUT:
_unschedule_packet_write_ready();
+ this->_propagate_event(event);
this->closed = 1;
break;
default:
@@ -207,6 +208,7 @@ QUICNetVConnection::state_established(int event, Event *data)
case VC_EVENT_ACTIVE_TIMEOUT:
case VC_EVENT_INACTIVITY_TIMEOUT:
_unschedule_packet_write_ready();
+ this->_propagate_event(event);
this->closed = 1;
break;
default:
@@ -254,6 +256,20 @@ QUICNetVConnection::_start_application()
}
}
+void
+QUICNetVConnection::_propagate_event(int event)
+{
+ QUICConVDebug("Propagating: %d", event);
+ if (this->read.vio.cont && this->read.vio.mutex == this->read.vio.cont->mutex) {
+ this->read.vio.cont->handleEvent(event, &this->read.vio);
+ } else if (this->write.vio.cont && this->write.vio.mutex == this->write.vio.cont->mutex) {
+ this->write.vio.cont->handleEvent(event, &this->write.vio);
+ } else {
+ // Proxy Session does not exist
+ QUICConVDebug("Session does not exist");
+ }
+}
+
bool
QUICNetVConnection::shouldDestroy()
{
@@ -263,15 +279,17 @@ QUICNetVConnection::shouldDestroy()
VIO *
QUICNetVConnection::do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf)
{
- ink_assert(false);
- return nullptr;
+ auto vio = super::do_io_read(c, nbytes, buf);
+ this->read.enabled = 1;
+ return vio;
}
VIO *
QUICNetVConnection::do_io_write(Continuation *c, int64_t nbytes, IOBufferReader *buf, bool owner)
{
- ink_assert(false);
- return nullptr;
+ auto vio = super::do_io_write(c, nbytes, buf);
+ this->write.enabled = 1;
+ return vio;
}
int
diff --git a/src/proxy/http3/Http3Session.cc b/src/proxy/http3/Http3Session.cc
index eb31215572..14ce9c18c4 100644
--- a/src/proxy/http3/Http3Session.cc
+++ b/src/proxy/http3/Http3Session.cc
@@ -90,20 +90,6 @@ HQSession::get_transaction(QUICStreamId id)
return nullptr;
}
-VIO *
-HQSession::do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf)
-{
- ink_assert(false);
- return nullptr;
-}
-
-VIO *
-HQSession::do_io_write(Continuation *c, int64_t nbytes, IOBufferReader *buf, bool owner)
-{
- ink_assert(false);
- return nullptr;
-}
-
void
HQSession::do_io_close(int lerrno)
{
@@ -131,14 +117,15 @@ HQSession::new_connection(NetVConnection *new_vc, MIOBuffer *iobuf, IOBufferRead
this->con_id = new_vc->get_service<QUICSupport>()->get_quic_connection()->connection_id();
this->_handle_if_ssl(new_vc);
- return;
+ do_api_callout(TS_HTTP_SSN_START_HOOK);
}
void
HQSession::start()
{
- ink_assert(false);
- return;
+ SET_HANDLER(&HQSession::main_event_handler);
+ this->do_io_read(this, 0, nullptr);
+ this->do_io_write(this, 0, nullptr);
}
void
@@ -166,6 +153,25 @@ HQSession::get_transact_count() const
return 0;
}
+int
+HQSession::main_event_handler(int event, void *edata)
+{
+ switch (event) {
+ case VC_EVENT_ACTIVE_TIMEOUT:
+ case VC_EVENT_INACTIVITY_TIMEOUT:
+ case VC_EVENT_ERROR:
+ case VC_EVENT_EOS:
+ this->do_io_close();
+ for (HQTransaction *t = this->_transaction_list.head; t; t = static_cast<HQTransaction *>(t->link.next)) {
+ SCOPED_MUTEX_LOCK(lock, t->mutex, this_ethread());
+ t->handleEvent(event);
+ }
+ break;
+ }
+
+ return 0;
+}
+
//
// Http3Session
//
diff --git a/src/proxy/http3/Http3Transaction.cc b/src/proxy/http3/Http3Transaction.cc
index 1b2388fcc4..11ce096ebd 100644
--- a/src/proxy/http3/Http3Transaction.cc
+++ b/src/proxy/http3/Http3Transaction.cc
@@ -345,6 +345,19 @@ HQTransaction::_close_write_complete_event(Event *e)
}
}
+void
+HQTransaction::_signal_event(int event)
+{
+ if (this->_write_vio.cont) {
+ SCOPED_MUTEX_LOCK(lock, this->_write_vio.mutex, this_ethread());
+ this->_write_vio.cont->handleEvent(event);
+ }
+ if (this->_read_vio.cont && this->_read_vio.cont != this->_write_vio.cont) {
+ SCOPED_MUTEX_LOCK(lock, this->_read_vio.mutex, this_ethread());
+ this->_read_vio.cont->handleEvent(event);
+ }
+}
+
/**
* @brief Signal event to this->_read_vio.cont
*/
@@ -490,6 +503,7 @@ Http3Transaction::state_stream_open(int event, Event *edata)
case VC_EVENT_INACTIVITY_TIMEOUT:
case VC_EVENT_ACTIVE_TIMEOUT: {
Http3TransVDebug("%s (%d)", get_vc_event_name(event), event);
+ this->_signal_event(event);
break;
}
default:
(trafficserver) 01/02: http3: Separate out Http3SettingsFramer (#11082)
Posted by cm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit e0878f3f0a9ada35f7c0013fb09dc12f793456d4
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Mon Feb 19 09:23:00 2024 -0700
http3: Separate out Http3SettingsFramer (#11082)
(cherry picked from commit 2416a781cff9c0dd56f6d554cded1cd605acf385)
---
include/proxy/http3/Http3App.h | 16 --------
include/proxy/http3/Http3SettingsFramer.h | 42 +++++++++++++++++++
src/proxy/http3/CMakeLists.txt | 1 +
src/proxy/http3/Http3App.cc | 46 +--------------------
src/proxy/http3/Http3SettingsFramer.cc | 67 +++++++++++++++++++++++++++++++
5 files changed, 111 insertions(+), 61 deletions(-)
diff --git a/include/proxy/http3/Http3App.h b/include/proxy/http3/Http3App.h
index 8b9d1cad02..50c05137a2 100644
--- a/include/proxy/http3/Http3App.h
+++ b/include/proxy/http3/Http3App.h
@@ -35,7 +35,6 @@
#include "proxy/http3/Http3Types.h"
#include "proxy/http3/Http3FrameDispatcher.h"
#include "proxy/http3/Http3FrameCollector.h"
-#include "proxy/http3/Http3FrameGenerator.h"
#include "proxy/http3/Http3FrameHandler.h"
#include "proxy/http3/QPACK.h"
@@ -94,18 +93,3 @@ private:
bool _is_control_stream_initialized = false;
};
-
-class Http3SettingsFramer : public Http3FrameGenerator
-{
-public:
- Http3SettingsFramer(NetVConnectionContext_t context) : _context(context){};
-
- // Http3FrameGenerator
- Http3FrameUPtr generate_frame() override;
- bool is_done() const override;
-
-private:
- NetVConnectionContext_t _context;
- bool _is_done = false; ///< Be careful when setting FIN flag on CONTROL stream. Maybe never?
- bool _is_sent = false; ///< Send SETTINGS frame only once
-};
diff --git a/include/proxy/http3/Http3SettingsFramer.h b/include/proxy/http3/Http3SettingsFramer.h
new file mode 100644
index 0000000000..c72a840e2a
--- /dev/null
+++ b/include/proxy/http3/Http3SettingsFramer.h
@@ -0,0 +1,42 @@
+/** @file
+ *
+ * A brief file description
+ *
+ * @section license License
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "proxy/http3/Http3FrameGenerator.h"
+#include "proxy/http3/Http3.h"
+
+class Http3SettingsFramer : public Http3FrameGenerator
+{
+public:
+ Http3SettingsFramer(NetVConnectionContext_t context) : _context(context){};
+
+ // Http3FrameGenerator
+ Http3FrameUPtr generate_frame() override;
+ bool is_done() const override;
+
+private:
+ NetVConnectionContext_t _context;
+ bool _is_done = false; ///< Be careful when setting FIN flag on CONTROL stream. Maybe never?
+ bool _is_sent = false; ///< Send SETTINGS frame only once
+};
diff --git a/src/proxy/http3/CMakeLists.txt b/src/proxy/http3/CMakeLists.txt
index 37e00b918d..9089b72cad 100644
--- a/src/proxy/http3/CMakeLists.txt
+++ b/src/proxy/http3/CMakeLists.txt
@@ -35,6 +35,7 @@ add_library(
Http3HeaderVIOAdaptor.cc
Http3ProtocolEnforcer.cc
Http3SettingsHandler.cc
+ Http3SettingsFramer.cc
Http3StreamDataVIOAdaptor.cc
QPACK.cc
)
diff --git a/src/proxy/http3/Http3App.cc b/src/proxy/http3/Http3App.cc
index c453950b6e..579b55eaef 100644
--- a/src/proxy/http3/Http3App.cc
+++ b/src/proxy/http3/Http3App.cc
@@ -39,6 +39,7 @@
#include "proxy/http3/Http3Transaction.h"
#include "proxy/http3/Http3ProtocolEnforcer.h"
#include "proxy/http3/Http3SettingsHandler.h"
+#include "proxy/http3/Http3SettingsFramer.h"
static constexpr char debug_tag[] = "http3";
static constexpr char debug_tag_v[] = "v_http3";
@@ -424,48 +425,3 @@ Http3App::_handle_bidi_stream_on_write_complete(int event, VIO *vio)
this->_qc->stream_manager()->delete_stream(stream_id);
this->_streams.erase(stream_id);
}
-
-//
-// SETTINGS frame framer
-//
-Http3FrameUPtr
-Http3SettingsFramer::generate_frame()
-{
- if (this->_is_sent) {
- return Http3FrameFactory::create_null_frame();
- }
-
- this->_is_sent = true;
-
- ts::Http3Config::scoped_config params;
-
- Http3SettingsFrame *frame = http3SettingsFrameAllocator.alloc();
- new (frame) Http3SettingsFrame();
-
- if (params->header_table_size() != HTTP3_DEFAULT_HEADER_TABLE_SIZE) {
- frame->set(Http3SettingsId::HEADER_TABLE_SIZE, params->header_table_size());
- }
-
- if (params->max_field_section_size() != HTTP3_DEFAULT_MAX_FIELD_SECTION_SIZE) {
- frame->set(Http3SettingsId::MAX_FIELD_SECTION_SIZE, params->max_field_section_size());
- }
-
- if (params->qpack_blocked_streams() != HTTP3_DEFAULT_QPACK_BLOCKED_STREAMS) {
- frame->set(Http3SettingsId::QPACK_BLOCKED_STREAMS, params->qpack_blocked_streams());
- }
-
- // Server side only
- if (this->_context == NET_VCONNECTION_IN) {
- if (params->num_placeholders() != HTTP3_DEFAULT_NUM_PLACEHOLDERS) {
- frame->set(Http3SettingsId::NUM_PLACEHOLDERS, params->num_placeholders());
- }
- }
-
- return Http3SettingsFrameUPtr(frame, &Http3FrameDeleter::delete_settings_frame);
-}
-
-bool
-Http3SettingsFramer::is_done() const
-{
- return this->_is_done;
-}
diff --git a/src/proxy/http3/Http3SettingsFramer.cc b/src/proxy/http3/Http3SettingsFramer.cc
new file mode 100644
index 0000000000..9ba20af754
--- /dev/null
+++ b/src/proxy/http3/Http3SettingsFramer.cc
@@ -0,0 +1,67 @@
+/** @file
+ *
+ * A brief file description
+ *
+ * @section license License
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "proxy/http3/Http3SettingsFramer.h"
+#include "proxy/http3/Http3Config.h"
+
+Http3FrameUPtr
+Http3SettingsFramer::generate_frame()
+{
+ if (this->_is_sent) {
+ return Http3FrameFactory::create_null_frame();
+ }
+
+ this->_is_sent = true;
+
+ ts::Http3Config::scoped_config params;
+
+ Http3SettingsFrame *frame = http3SettingsFrameAllocator.alloc();
+ new (frame) Http3SettingsFrame();
+
+ if (params->header_table_size() != HTTP3_DEFAULT_HEADER_TABLE_SIZE) {
+ frame->set(Http3SettingsId::HEADER_TABLE_SIZE, params->header_table_size());
+ }
+
+ if (params->max_field_section_size() != HTTP3_DEFAULT_MAX_FIELD_SECTION_SIZE) {
+ frame->set(Http3SettingsId::MAX_FIELD_SECTION_SIZE, params->max_field_section_size());
+ }
+
+ if (params->qpack_blocked_streams() != HTTP3_DEFAULT_QPACK_BLOCKED_STREAMS) {
+ frame->set(Http3SettingsId::QPACK_BLOCKED_STREAMS, params->qpack_blocked_streams());
+ }
+
+ // Server side only
+ if (this->_context == NET_VCONNECTION_IN) {
+ if (params->num_placeholders() != HTTP3_DEFAULT_NUM_PLACEHOLDERS) {
+ frame->set(Http3SettingsId::NUM_PLACEHOLDERS, params->num_placeholders());
+ }
+ }
+
+ return Http3SettingsFrameUPtr(frame, &Http3FrameDeleter::delete_settings_frame);
+}
+
+bool
+Http3SettingsFramer::is_done() const
+{
+ return this->_is_done;
+}