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

Method do_io_close

src/iocore/net/UnixNetVConnection.cc:262–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260}
261
262void
263UnixNetVConnection::do_io_close(int alerrno /* = -1 */)
264{
265 // The vio continuations will be cleared in ::clear called from ::free_thread
266 read.enabled = 0;
267 write.enabled = 0;
268 read.vio.nbytes = 0;
269 read.vio.op = VIO::NONE;
270
271 if (netvc_context == NET_VCONNECTION_OUT) {
272 // do not clear the iobufs yet to guard
273 // against race condition with session pool closing
274 Dbg(dbg_ctl_iocore_net, "delay vio buffer clear to protect against race for vc %p", this);
275 } else {
276 // may be okay to delay for all VCs?
277 read.vio.buffer.clear();
278 write.vio.buffer.clear();
279 }
280
281 write.vio.nbytes = 0;
282 write.vio.op = VIO::NONE;
283
284 EThread *t = this_ethread();
285 bool close_inline = !recursion && (!nh || nh->mutex->thread_holding == t);
286
287 INK_WRITE_MEMORY_BARRIER;
288 if (alerrno && alerrno != -1) {
289 this->lerrno = alerrno;
290 }
291
292 // Must mark for closed last in case this is a
293 // cross thread migration scenario.
294 if (alerrno == -1) {
295 closed = 1;
296 } else {
297 closed = -1;
298 }
299
300 if (close_inline) {
301 if (nh) {
302 nh->free_netevent(this);
303 } else {
304 this->free_thread(t);
305 }
306 }
307}
308
309void
310UnixNetVConnection::do_io_shutdown(ShutdownHowTo_t howto)

Callers 1

Calls 4

free_threadMethod · 0.95
this_ethreadFunction · 0.85
free_neteventMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected