Beispiel #1
0
void LibEventServer::onResponse(int worker, evhttp_request *request,
                                int code, LibEventTransport *transport) {
  int nwritten = 0;
  bool skip_sync = false;

  if (request->evcon == nullptr) {
    evhttp_request_free(request);
    return;
  }

#ifdef _EVENT_USE_OPENSSL
  skip_sync = evhttp_is_connection_ssl(request->evcon);
#endif

  int totalSize = 0;

  if (RuntimeOption::LibEventSyncSend && !skip_sync) {
    const char *reason = HttpProtocol::GetReasonString(code);
    timespec begin, end;
    Timer::GetMonotonicTime(begin);
#ifdef EVHTTP_SYNC_SEND_REPORT_TOTAL_LEN
    nwritten = evhttp_send_reply_sync(request, code, reason, nullptr, &totalSize);
#else
    nwritten = evhttp_send_reply_sync_begin(request, code, reason, nullptr);
#endif
    Timer::GetMonotonicTime(end);
    int64_t delay = gettime_diff_us(begin, end);
    transport->onFlushBegin(totalSize);
    transport->onFlushProgress(nwritten, delay);
  }
  m_responseQueue.enqueue(worker, request, code, nwritten);
}
Beispiel #2
0
void LibEventServer::onResponse(int worker, evhttp_request *request,
                                int code) {
  int nwritten = 0;
  if (RuntimeOption::LibEventSyncSend) {
    const char *reason = HttpProtocol::GetReasonString(code);
    nwritten = evhttp_send_reply_sync_begin(request, code, reason, NULL);
  }
  m_responseQueue.enqueue(worker, request, code, nwritten);
}
Beispiel #3
0
void LibEventServer::onResponse(int worker, evhttp_request *request,
                                int code) {
  int nwritten = 0;
  bool skip_sync = false;
#ifdef _EVENT_USE_OPENSSL
  skip_sync = evhttp_is_connection_ssl(request->evcon);
#endif

  if (RuntimeOption::LibEventSyncSend && !skip_sync) {
    const char *reason = HttpProtocol::GetReasonString(code);
    nwritten = evhttp_send_reply_sync_begin(request, code, reason, NULL);
  }
  m_responseQueue.enqueue(worker, request, code, nwritten);
}