From 4393eba8901e5485b2dcc71f667328158613f971 Mon Sep 17 00:00:00 2001 From: Seonah Moon Date: Wed, 1 Apr 2020 17:54:59 +0900 Subject: [PATCH] Change HTTP state properly Sometimes HTTP thread works abnormally because HTTP state isn't changed properly. Change-Id: I5462b6497bd5a7bd64c5b600a00aa7cf3e1954ff --- agent/download-agent-http-mgr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/agent/download-agent-http-mgr.c b/agent/download-agent-http-mgr.c index 1ea3dff..4dc9978 100755 --- a/agent/download-agent-http-mgr.c +++ b/agent/download-agent-http-mgr.c @@ -679,7 +679,7 @@ da_ret_t request_to_cancel_http_download(da_info_t *da_info) case HTTP_STATE_DOWNLOADING: case HTTP_STATE_REQUEST_RESUME: case HTTP_STATE_RESUMED: - ret = PI_http_cancel(http_info); + DA_LOGI("Change http_info->state to HTTP_STATE_REQUEST_CANCEL"); mutex_ret = pthread_mutex_lock(&(http_info->mutex_state)); if (mutex_ret == 0) { http_info->state = HTTP_STATE_REQUEST_CANCEL; @@ -689,6 +689,7 @@ da_ret_t request_to_cancel_http_download(da_info_t *da_info) } else { DA_LOGE("pthread_mutex_lock FAIL with [%d]", mutex_ret); } + ret = PI_http_cancel(http_info); break; case HTTP_STATE_DOWNLOAD_FINISH: ret = DA_ERR_INVALID_STATE; @@ -1521,7 +1522,6 @@ da_ret_t __handle_event_http_final(http_raw_data_t *raw_data, da_info_t *da_info DA_MUTEX_LOCK(&(http_info->mutex_state)); http_info->state = HTTP_STATE_PAUSED; DA_MUTEX_UNLOCK(&(http_info->mutex_state)); - DA_LOGV("Server Notification code is set to NULL"); break; case HTTP_STATE_ABORTED: case HTTP_STATE_CANCELED: -- 2.7.4