Ejemplo n.º 1
0
Archivo: evcom.c Proyecto: bernd/node
/* Internal callback. called by stream->timeout_watcher */
static void
on_timeout (EV_P_ ev_timer *watcher, int revents)
{
  evcom_stream *stream = watcher->data;

#if EV_MULTIPLICITY
  assert(stream->loop == loop);
#endif
  assert(revents == EV_TIMEOUT);
  assert(watcher == &stream->timeout_watcher);

  if (PAUSED(stream)) {
    ev_timer_again(D_LOOP_(stream) &stream->timeout_watcher);
    return;
  }

  if (stream->on_timeout) stream->on_timeout(stream);

  // Hack to get error in Node on 'close' event.
  // should probably be made into a proper error code.
  stream->errorno = 1;

  ev_timer_stop(EV_A_ watcher);
  evcom_stream_force_close(stream);

  if (stream->on_close) stream->on_close(stream);
}
Ejemplo n.º 2
0
Archivo: evcom.c Proyecto: blaine/node
/* Internal callback. called by stream->timeout_watcher */
static void
on_timeout (EV_P_ ev_timer *watcher, int revents)
{
  evcom_stream *stream = watcher->data;

#if EV_MULTIPLICITY
  assert(stream->loop == loop);
#endif
  assert(revents == EV_TIMEOUT);
  assert(watcher == &stream->timeout_watcher);

  if (PAUSED(stream)) {
    ev_timer_again(D_LOOP_(stream) &stream->timeout_watcher);
    return;
  }

  if (stream->on_timeout) stream->on_timeout(stream);

  evcom_stream_force_close(stream);

  if (stream->on_close) stream->on_close(stream);
}