完善httpclientpool

This commit is contained in:
aozhiwei 2019-01-12 15:10:19 +08:00
parent 3e8beea319
commit d5d9f92e67
2 changed files with 3 additions and 8 deletions

View File

@ -300,7 +300,7 @@ namespace f8
std::vector<HttpThread*> http_thread_pool; std::vector<HttpThread*> http_thread_pool;
}; };
void HttpClientPool::Init() void HttpClientPool::Init(int thread_num)
{ {
impl_ = new HttpClientPoolImpl(); impl_ = new HttpClientPoolImpl();
impl_->Init(); impl_->Init();
@ -317,6 +317,7 @@ namespace f8
} }
} }
); );
impl_->SetThreadNum(thread_num);
} }
void HttpClientPool::UnInit() void HttpClientPool::UnInit()
@ -325,11 +326,6 @@ namespace f8
impl_ = nullptr; impl_ = nullptr;
} }
void HttpClientPool::SetThreadNum(int thread_num)
{
impl_->SetThreadNum(thread_num);
}
void HttpClientPool::HttpGet(a8::XParams param, AsyncHttpOnOkFunc on_ok, AsyncHttpOnErrorFunc on_error, void HttpClientPool::HttpGet(a8::XParams param, AsyncHttpOnOkFunc on_ok, AsyncHttpOnErrorFunc on_error,
const char* url, a8::XObject url_params, const char* url, a8::XObject url_params,
long long hash_code, a8::XObject* headers) long long hash_code, a8::XObject* headers)

View File

@ -14,9 +14,8 @@ namespace f8
friend class a8::Singleton<HttpClientPool>; friend class a8::Singleton<HttpClientPool>;
public: public:
void Init(); void Init(int thread_num);
void UnInit(); void UnInit();
void SetThreadNum(int thread_num);
//执行异步http get //执行异步http get
void HttpGet(a8::XParams param, AsyncHttpOnOkFunc on_ok, AsyncHttpOnErrorFunc on_error, void HttpGet(a8::XParams param, AsyncHttpOnOkFunc on_ok, AsyncHttpOnErrorFunc on_error,