示例#1
0
	void print(const x0::BufferRef& v, const char *msg = 0)
	{
		if (msg && *msg)
			printf("buffer.view(%s): '%s'\n", msg, v.str().c_str());
		else
			printf("buffer.view: '%s'\n", v.str().c_str());

		printf("  size=%ld\n", v.size());
	}
示例#2
0
文件: io_test.cpp 项目: tempbottle/x0
  void print(const x0::BufferRef& v, const char* msg = 0) {
    char prefix[64];
    if (msg && *msg)
      snprintf(prefix, sizeof(prefix), "\nbuffer.view(%s)", msg);
    else
      snprintf(prefix, sizeof(prefix), "\nbuffer.view");

    if (v)
      printf("\n%s: '%s' (size=%ld)\n", prefix, v.str().c_str(), v.size());
    else
      printf("\n%s: NULL\n", prefix);
  }
示例#3
0
	void onContent(const x0::BufferRef& chunk)
	{
		if (chunk.empty()) {
			if (created_)
				request_->status = x0::HttpStatus::Created;
			else
				request_->status = x0::HttpStatus::NoContent;

			request_->finish();
			::close(fd_);

			delete this;
		} else {
			::write(fd_, chunk.data(), chunk.size());
			// check return code and possibly early abort request with error code indicating diagnostics
		}
	}
示例#4
0
void FastCgiHealthMonitor::onStdOut(const x0::BufferRef& chunk)
{
	TRACE("onStdOut: chunk.size=%ld", chunk.size());
	process(chunk);
}