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

Method reenable

src/iocore/net/UnixNetVConnection.cc:350–420  ·  view source on GitHub ↗

Function used to reenable the VC for reading or writing.

Source from the content-addressed store, hash-verified

348// writing.
349//
350void
351UnixNetVConnection::reenable(VIO *vio)
352{
353 if (STATE_FROM_VIO(vio)->enabled) {
354 return;
355 }
356 set_enabled(vio);
357 if (!thread) {
358 return;
359 }
360 EThread *t = vio->mutex->thread_holding;
361 ink_assert(t == this_ethread());
362 ink_release_assert(!closed);
363 if (nh->mutex->thread_holding == t) {
364 if (vio == &read.vio) {
365 ep.modify(EVENTIO_READ);
366 ep.refresh(EVENTIO_READ);
367 if (read.triggered) {
368 nh->read_ready_list.in_or_enqueue(this);
369 } else {
370 nh->read_ready_list.remove(this);
371 }
372 } else {
373 ep.modify(EVENTIO_WRITE);
374 ep.refresh(EVENTIO_WRITE);
375 if (write.triggered) {
376 nh->write_ready_list.in_or_enqueue(this);
377 } else {
378 nh->write_ready_list.remove(this);
379 }
380 }
381 } else {
382 MUTEX_TRY_LOCK(lock, nh->mutex, t);
383 if (!lock.is_locked()) {
384 if (vio == &read.vio) {
385 int isin = ink_atomic_swap(&read.in_enabled_list, 1);
386 if (!isin) {
387 nh->read_enable_list.push(this);
388 }
389 } else {
390 int isin = ink_atomic_swap(&write.in_enabled_list, 1);
391 if (!isin) {
392 nh->write_enable_list.push(this);
393 }
394 }
395 if (likely(nh->thread)) {
396 nh->thread->tail_cb->signalActivity();
397 } else if (nh->trigger_event) {
398 nh->trigger_event->ethread->tail_cb->signalActivity();
399 }
400 } else {
401 if (vio == &read.vio) {
402 ep.modify(EVENTIO_READ);
403 ep.refresh(EVENTIO_READ);
404 if (read.triggered) {
405 nh->read_ready_list.in_or_enqueue(this);
406 } else {
407 nh->read_ready_list.remove(this);

Callers 2

do_io_readMethod · 0.45
do_io_writeMethod · 0.45

Calls 8

this_ethreadFunction · 0.85
ink_atomic_swapFunction · 0.85
modifyMethod · 0.80
in_or_enqueueMethod · 0.80
refreshMethod · 0.45
removeMethod · 0.45
pushMethod · 0.45
signalActivityMethod · 0.45

Tested by

no test coverage detected