mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-13 03:31:45 +08:00
重写http客户端异常处理机制
This commit is contained in:
@@ -32,9 +32,9 @@ API_EXPORT void API_CALL mk_http_downloader_release(mk_http_downloader ctx) {
|
||||
API_EXPORT void API_CALL mk_http_downloader_start(mk_http_downloader ctx, const char *url, const char *file, on_mk_download_complete cb, void *user_data) {
|
||||
assert(ctx && url && file);
|
||||
HttpDownloader::Ptr *obj = (HttpDownloader::Ptr *) ctx;
|
||||
(*obj)->setOnResult([cb, user_data](ErrCode code, const string &errMsg, const string &filePath) {
|
||||
(*obj)->setOnResult([cb, user_data](const SockException &ex, const string &filePath) {
|
||||
if (cb) {
|
||||
cb(user_data, code, errMsg.data(), filePath.data());
|
||||
cb(user_data, ex.getErrCode(), ex.what(), filePath.data());
|
||||
}
|
||||
});
|
||||
(*obj)->startDownload(url, file, false);
|
||||
|
||||
Reference in New Issue
Block a user