|
|
@@ -114,17 +114,7 @@ public:
|
|
|
}
|
|
|
|
|
|
// thread-safe
|
|
|
- int send(const HttpRequestPtr& req, HttpResponseCallback resp_cb) {
|
|
|
- auto task = std::make_shared<HttpClientTask>();
|
|
|
- task->req = req;
|
|
|
- task->cb = std::move(resp_cb);
|
|
|
- task->start_time = hloop_now_hrtime(EventLoopThread::hloop());
|
|
|
- if (req->retry_count > 0 && req->retry_delay > 0) {
|
|
|
- req->retry_count = MIN(req->retry_count, req->timeout * 1000 / req->retry_delay - 1);
|
|
|
- }
|
|
|
- return send(task);
|
|
|
- }
|
|
|
-
|
|
|
+ int send(const HttpRequestPtr& req, HttpResponseCallback resp_cb);
|
|
|
int send(const HttpClientTaskPtr& task) {
|
|
|
EventLoopThread::loop()->queueInLoop(std::bind(&AsyncHttpClient::sendInLoop, this, task));
|
|
|
return 0;
|