MCPcopy Create free account
hub / github.com/apache/trafficserver / main_event_handler

Method main_event_handler

src/proxy/http3/Http09App.cc:96–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96int
97Http09App::main_event_handler(int event, Event *data)
98{
99 Dbg(dbg_ctl_v, "[%s] %s (%d)", this->_qc->cids().data(), get_vc_event_name(event), event);
100
101 VIO *vio = reinterpret_cast<VIO *>(data->cookie);
102 QUICStreamVCAdapter *adapter = static_cast<QUICStreamVCAdapter *>(vio->vc_server);
103
104 if (adapter == nullptr) {
105 Dbg(dbg_ctl, "[%s] Unknown Stream", this->_qc->cids().data());
106 return -1;
107 }
108
109 bool is_bidirectional = adapter->stream().is_bidirectional();
110
111 QUICStreamId stream_id = adapter->stream().id();
112 Http09Transaction *txn = static_cast<Http09Transaction *>(this->_ssn->get_transaction(stream_id));
113
114 switch (event) {
115 case VC_EVENT_READ_READY:
116 case VC_EVENT_READ_COMPLETE:
117 if (!is_bidirectional) {
118 // FIXME Ignore unidirectional streams for now
119 break;
120 }
121
122 if (txn == nullptr) {
123 if (auto ret = this->_streams.find(stream_id); ret != this->_streams.end()) {
124 txn = new Http09Transaction(this->_ssn, ret->second);
125 SCOPED_MUTEX_LOCK(lock, txn->mutex, this_ethread());
126 txn->new_transaction();
127 } else {
128 ink_assert(!"Stream info should exist");
129 }
130 } else {
131 SCOPED_MUTEX_LOCK(lock, txn->mutex, this_ethread());
132 txn->handleEvent(event);
133 }
134 break;
135 case VC_EVENT_WRITE_READY:
136 case VC_EVENT_WRITE_COMPLETE:
137 if (txn != nullptr) {
138 SCOPED_MUTEX_LOCK(lock, txn->mutex, this_ethread());
139 txn->handleEvent(event);
140 }
141 break;
142 case VC_EVENT_EOS:
143 case VC_EVENT_ERROR:
144 case VC_EVENT_INACTIVITY_TIMEOUT:
145 case VC_EVENT_ACTIVE_TIMEOUT:
146 ink_assert(false);
147 break;
148 default:
149 break;
150 }
151
152 return EVENT_CONT;
153}

Callers

nothing calls this directly

Calls 11

get_vc_event_nameFunction · 0.85
this_ethreadFunction · 0.85
is_bidirectionalMethod · 0.80
get_transactionMethod · 0.80
dataMethod · 0.45
cidsMethod · 0.45
idMethod · 0.45
findMethod · 0.45
endMethod · 0.45
new_transactionMethod · 0.45
handleEventMethod · 0.45

Tested by

no test coverage detected