| 135 | } |
| 136 | |
| 137 | int |
| 138 | Http3App::main_event_handler(int event, Event *data) |
| 139 | { |
| 140 | Dbg(dbg_ctl_v, "[%s] %s (%d)", this->_qc->cids().data(), get_vc_event_name(event), event); |
| 141 | |
| 142 | VIO *vio = reinterpret_cast<VIO *>(data->cookie); |
| 143 | QUICStreamVCAdapter *adapter = static_cast<QUICStreamVCAdapter *>(vio->vc_server); |
| 144 | |
| 145 | if (adapter == nullptr) { |
| 146 | Dbg(dbg_ctl, "[%s] Unknown Stream", this->_qc->cids().data()); |
| 147 | return -1; |
| 148 | } |
| 149 | |
| 150 | bool is_bidirectional = adapter->stream().is_bidirectional(); |
| 151 | |
| 152 | switch (event) { |
| 153 | case VC_EVENT_READ_READY: |
| 154 | adapter->clear_read_ready_event(data); |
| 155 | if (is_bidirectional) { |
| 156 | this->_handle_bidi_stream_on_read_ready(event, vio); |
| 157 | } else { |
| 158 | this->_handle_uni_stream_on_read_ready(event, vio); |
| 159 | } |
| 160 | break; |
| 161 | case VC_EVENT_READ_COMPLETE: |
| 162 | adapter->clear_read_complete_event(data); |
| 163 | if (is_bidirectional) { |
| 164 | this->_handle_bidi_stream_on_read_complete(event, vio); |
| 165 | } else { |
| 166 | this->_handle_uni_stream_on_read_complete(event, vio); |
| 167 | } |
| 168 | break; |
| 169 | case VC_EVENT_WRITE_READY: |
| 170 | adapter->clear_write_ready_event(data); |
| 171 | if (is_bidirectional) { |
| 172 | this->_handle_bidi_stream_on_write_ready(event, vio); |
| 173 | } else { |
| 174 | this->_handle_uni_stream_on_write_ready(event, vio); |
| 175 | } |
| 176 | break; |
| 177 | case VC_EVENT_WRITE_COMPLETE: |
| 178 | adapter->clear_write_complete_event(data); |
| 179 | if (is_bidirectional) { |
| 180 | this->_handle_bidi_stream_on_write_complete(event, vio); |
| 181 | } else { |
| 182 | this->_handle_uni_stream_on_write_complete(event, vio); |
| 183 | } |
| 184 | break; |
| 185 | case VC_EVENT_EOS: |
| 186 | adapter->clear_eos_event(data); |
| 187 | if (is_bidirectional) { |
| 188 | this->_handle_bidi_stream_on_eos(event, vio); |
| 189 | } else { |
| 190 | this->_handle_uni_stream_on_eos(event, vio); |
| 191 | } |
| 192 | break; |
| 193 | case VC_EVENT_ERROR: |
| 194 | case VC_EVENT_INACTIVITY_TIMEOUT: |
nothing calls this directly
no test coverage detected