Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions iocore/eventsystem/I_Thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@ class Thread
ProxyAllocator http2ClientSessionAllocator;
ProxyAllocator http2StreamAllocator;
ProxyAllocator quicClientSessionAllocator;
ProxyAllocator quicBidiStreamAllocator;
ProxyAllocator quicSendStreamAllocator;
ProxyAllocator quicReceiveStreamAllocator;
ProxyAllocator httpServerSessionAllocator;
ProxyAllocator hdrHeapAllocator;
ProxyAllocator strHeapAllocator;
Expand Down
36 changes: 4 additions & 32 deletions iocore/net/quic/QUICStreamFactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,20 @@
#include "QUICUnidirectionalStream.h"
#include "QUICStreamFactory.h"

ClassAllocator<QUICBidirectionalStream> quicBidiStreamAllocator("quicBidiStreamAllocator");
ClassAllocator<QUICSendStream> quicSendStreamAllocator("quicSendStreamAllocator");
ClassAllocator<QUICReceiveStream> quicReceiveStreamAllocator("quicReceiveStreamAllocator");

QUICStreamVConnection *
QUICStreamFactory::create(QUICStreamId sid, uint64_t local_max_stream_data, uint64_t remote_max_stream_data)
{
QUICStreamVConnection *stream = nullptr;
switch (QUICTypeUtil::detect_stream_direction(sid, this->_info->direction())) {
case QUICStreamDirection::BIDIRECTIONAL:
// TODO Free the stream somewhere
stream = THREAD_ALLOC(quicBidiStreamAllocator, this_ethread());
new (stream) QUICBidirectionalStream(this->_rtt_provider, this->_info, sid, local_max_stream_data, remote_max_stream_data);
stream = new QUICBidirectionalStream(this->_rtt_provider, this->_info, sid, local_max_stream_data, remote_max_stream_data);
break;
case QUICStreamDirection::SEND:
// TODO Free the stream somewhere
stream = THREAD_ALLOC(quicSendStreamAllocator, this_ethread());
new (stream) QUICSendStream(this->_info, sid, remote_max_stream_data);
stream = new QUICSendStream(this->_info, sid, remote_max_stream_data);
break;
case QUICStreamDirection::RECEIVE:
// server side
// TODO Free the stream somewhere
stream = THREAD_ALLOC(quicReceiveStreamAllocator, this_ethread());
new (stream) QUICReceiveStream(this->_rtt_provider, this->_info, sid, local_max_stream_data);
stream = new QUICReceiveStream(this->_rtt_provider, this->_info, sid, local_max_stream_data);
break;
default:
ink_assert(false);
Expand All @@ -62,23 +52,5 @@ QUICStreamFactory::create(QUICStreamId sid, uint64_t local_max_stream_data, uint
void
QUICStreamFactory::delete_stream(QUICStreamVConnection *stream)
{
if (!stream) {
return;
}

stream->~QUICStreamVConnection();
switch (stream->direction()) {
case QUICStreamDirection::BIDIRECTIONAL:
THREAD_FREE(static_cast<QUICBidirectionalStream *>(stream), quicBidiStreamAllocator, this_thread());
break;
case QUICStreamDirection::SEND:
THREAD_FREE(static_cast<QUICSendStream *>(stream), quicSendStreamAllocator, this_thread());
break;
case QUICStreamDirection::RECEIVE:
THREAD_FREE(static_cast<QUICReceiveStream *>(stream), quicReceiveStreamAllocator, this_thread());
break;
default:
ink_assert(false);
break;
}
delete stream;
}
7 changes: 7 additions & 0 deletions iocore/net/quic/QUICStreamManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ QUICStreamManager::QUICStreamManager(QUICContext *context, QUICApplicationMap *a
}
}

QUICStreamManager::~QUICStreamManager()
{
for (auto stream = stream_list.pop(); stream != nullptr; stream = stream_list.pop()) {
_stream_factory.delete_stream(stream);
}
}

std::vector<QUICFrameType>
QUICStreamManager::interests()
{
Expand Down
1 change: 1 addition & 0 deletions iocore/net/quic/QUICStreamManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class QUICStreamManager : public QUICFrameHandler, public QUICFrameGenerator
{
public:
QUICStreamManager(QUICContext *context, QUICApplicationMap *app_map);
~QUICStreamManager();

void init_flow_control_params(const std::shared_ptr<const QUICTransportParameters> &local_tp,
const std::shared_ptr<const QUICTransportParameters> &remote_tp);
Expand Down