You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by Chao Xu <xu...@gmail.com> on 2015/12/31 10:53:01 UTC

Question on wbe_event of write_to_net_io() .

Dear All,

I'm reading the ATS code now,

there are 2 variables: "signalled" and "wbe_event",

the comment: "signalled means we won't send an event"

{code}
    } else if (signalled && (wbe_event != vc->write_buffer_empty_event)) {
      // @a signalled means we won't send an event, and the event values
differing means we
      // had a write buffer trap and cleared it, so we need to send it now.
      if (write_signal_and_update(wbe_event, vc) != EVENT_CONT)
        return;
{code}

but the variable "signalled" is set to 1 after send a VC_EVENT_WRITE_READY
event:

{code}
  if (towrite != ntodo && buf.writer()->write_avail()) {
    if (write_signal_and_update(VC_EVENT_WRITE_READY, vc) != EVENT_CONT) {
      return;
    }

    ntodo = s->vio.ntodo();
    if (ntodo <= 0) {
      write_disable(nh, vc);
      return;
    }

    signalled = 1;

    // Recalculate amount to write
    towrite = buf.reader()->read_avail();
    if (towrite > ntodo)
      towrite = ntodo;
  }
{code}

that is means we have sent an event if signalled == 1, that conflicted with
the wbe_event comments.

I was wondering whether the comments is wrong or the code “if (signalled &&
..." should be "if (!signalled && ...".


Thanks!

Oknet Xu