当前位置: 首页>>代码示例>>C++>>正文


C++ ConnectionManager::getConnExceptions方法代码示例

本文整理汇总了C++中ConnectionManager::getConnExceptions方法的典型用法代码示例。如果您正苦于以下问题:C++ ConnectionManager::getConnExceptions方法的具体用法?C++ ConnectionManager::getConnExceptions怎么用?C++ ConnectionManager::getConnExceptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConnectionManager的用法示例。


在下文中一共展示了ConnectionManager::getConnExceptions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: processMessage

int HttpServerMsgHandler::processMessage(void *arg) {
	struct evhttp_request *req = (struct evhttp_request *)arg;

	const char *cmdtype;
	struct evkeyvalq *headers;
	struct evkeyval *header;

	switch (evhttp_request_get_command(req)) {
	case EVHTTP_REQ_GET: cmdtype = "GET"; break;
	case EVHTTP_REQ_POST: cmdtype = "POST"; break;
	case EVHTTP_REQ_HEAD: cmdtype = "HEAD"; break;
	case EVHTTP_REQ_PUT: cmdtype = "PUT"; break;
	case EVHTTP_REQ_DELETE: cmdtype = "DELETE"; break;
	case EVHTTP_REQ_OPTIONS: cmdtype = "OPTIONS"; break;
	case EVHTTP_REQ_TRACE: cmdtype = "TRACE"; break;
	case EVHTTP_REQ_CONNECT: cmdtype = "CONNECT"; break;
	case EVHTTP_REQ_PATCH: cmdtype = "PATCH"; break;
	default: cmdtype = "unknown"; break;
	}

	printf("Received a %s request for %s\nHeaders:\n",
		cmdtype, evhttp_request_get_uri(req));

	headers = evhttp_request_get_input_headers(req);
	for (header = headers->tqh_first; header;
		header = header->next.tqe_next) {
			printf("  %s: %s\n", header->key, header->value);
	}

	ConnectionManager *conn = ConnectionManager::getInstance();
	struct evbuffer *return_buffer=evbuffer_new();

	long long total_req = conn->getTotalRequests();
	long long total_res = conn->getTotalResponses();
	unsigned int conns = conn->getConnections();

	long long timeouts = conn->getTimeoutRequests();
	long long err_res = conn->getErrorResponses();
	long long conn_except = conn->getConnExceptions();
	long long ok_res = conn->getOkResponses();

	evbuffer_add_printf(return_buffer,"    total request: %lld<br>	   total response: %lld<br>	   connnections: %u<br><br><hr><br>	ok: %lld	\
		<br>	timeout: %lld<br>	http error: %lld<br>    connExcept: %u<br>"
		, total_req, total_res, conns, ok_res, timeouts, err_res, conn_except);
	evhttp_send_reply(req, HTTP_OK, "OK", return_buffer);
	evbuffer_free(return_buffer);

	return 0;
}
开发者ID:chenbk85,项目名称:libeventInterface,代码行数:49,代码来源:HttpServerMsgHandler.cpp


注:本文中的ConnectionManager::getConnExceptions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。