コード例 #1
0
ファイル: pipeline.cpp プロジェクト: darcyg/great-hole
void pipeline::resume() {
	if (state != paused) {
		BOOST_LOG_TRIVIAL(error) << "pipeline(" << this << ") is not paused: " << state;
		return;
	}
	state = running;
	schedule_read();
}
コード例 #2
0
ファイル: abuf_pipe.C プロジェクト: Halfnhav4/okws
void
abuf_pipe_t::readcb (str s, int err)
{
  _read_outstanding = false;
  if (!s) {
    _eof = true;
  } else {
    _bufs.push_back (s);
  }

  ptr<bool> df = _destroyed;
  if (_cb) (*_cb) ();
  if (!*df) schedule_read ();
}
コード例 #3
0
ファイル: pipeline.cpp プロジェクト: darcyg/great-hole
void pipeline::schedule_read() {
	if (state == running && !read_pending) {
		read_pending = true;
		in->async_read([this, me = shared_from_this()](const gh::error_code &ec, packet &&p) {
			read_pending = false;
			fc.after_read();
			if (!ec) {
				if (!write_pending) {
					process(std::move(p));
				} else {
					buffer.push(std::move(p));
				}
			} else {
				BOOST_LOG_TRIVIAL(error) << "pipeline(" << this << ") read error: " << ec.message();
				stop();
			}
			schedule_read();
		});
	}
}
コード例 #4
0
ファイル: abuf_pipe.C プロジェクト: Halfnhav4/okws
void
abuf_pipe_t::init (cbv c)
{
  _cb = c;
  schedule_read ();
}