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

Method Handle

plugins/experimental/inliner/ts.cc:153–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151 }
152
153 int
154 WriteOperation::Handle(const TSCont c, const TSEvent e, [[maybe_unused]] void *d)
155 {
156 assert(c != nullptr);
157 WriteOperationPointer *const p = static_cast<WriteOperationPointer *>(TSContDataGet(c));
158
159 if (TS_EVENT_VCONN_WRITE_COMPLETE == e) {
160 Dbg(dbg_ctl, "TS_EVENT_VCONN_WRITE_COMPLETE");
161 if (p != nullptr) {
162 TSContDataSet(c, nullptr);
163 delete p;
164 }
165 return TS_SUCCESS;
166 }
167
168 assert(p != nullptr);
169 assert(*p);
170 WriteOperation &operation = **p;
171 assert(operation.continuation_ == c);
172 assert(operation.vconnection_ != nullptr);
173 assert(d != nullptr);
174 assert(TS_EVENT_ERROR == e || TS_EVENT_TIMEOUT == e || TS_EVENT_VCONN_WRITE_READY == e);
175
176 switch (e) {
177 case TS_EVENT_ERROR:
178 TSError("[" PLUGIN_TAG "] TS_EVENT_ERROR from producer");
179 goto handle_error; // handle errors as timeouts
180
181 case TS_EVENT_TIMEOUT:
182 TSError("[" PLUGIN_TAG "] TS_EVENT_TIMEOUT from producer");
183
184 handle_error:
185 operation.close();
186 assert(operation.action_ != nullptr);
187 operation.action_ = nullptr;
188 /*
189 TSContDataSet(c, NULL);
190 delete p;
191 */
192 break;
193 case TS_EVENT_VCONN_WRITE_READY:
194 operation.reenable_ = true;
195 break;
196
197 default:
198 TSError("[" PLUGIN_TAG "] Unknown event: %i", e);
199 assert(false); // UNREACHABLE
200 break;
201 }
202
203 return TS_SUCCESS;
204 }
205
206 WriteOperationWeakPointer
207 WriteOperation::Create(const TSVConn v, const TSMutex m, const size_t t)

Callers

nothing calls this directly

Calls 4

TSContDataGetFunction · 0.85
TSContDataSetFunction · 0.85
TSErrorFunction · 0.50
closeMethod · 0.45

Tested by

no test coverage detected