diff options
author | Jungki Kwak <jungki.kwak@samsung.com> | 2012-09-05 18:50:44 +0900 |
---|---|---|
committer | Bang Kwang min <justine.bang@samsung.com> | 2012-09-07 11:11:42 +0900 |
commit | dee14ba38f26131968c44c74a74eddc3cbff1aa6 (patch) | |
tree | ad1086110fc1ff903b1fabe6adf0742a696ac85c | |
parent | e4908281281c11356c8581fd113fc16a4ec54007 (diff) | |
download | download-provider-dee14ba38f26131968c44c74a74eddc3cbff1aa6.tar.gz download-provider-dee14ba38f26131968c44c74a74eddc3cbff1aa6.tar.bz2 download-provider-dee14ba38f26131968c44c74a74eddc3cbff1aa6.zip |
Add to search download id from history db
[Title] Add to search download id from history db
[Issue#] N/A
[Problem] N/A
[Cause] N/A
[Solution] If client restart the download after stoping it, the download id is exised at history db.
modified: src/download-provider-db.c
modified: src/download-provider-receiver.c
Change-Id: I7ce0c30b6cf0ea3c3ccf5f3ad629f364b8585601
-rw-r--r-- | src/download-provider-db.c | 1 | ||||
-rw-r--r-- | src/download-provider-receiver.c | 24 |
2 files changed, 19 insertions, 6 deletions
diff --git a/src/download-provider-db.c b/src/download-provider-db.c index 5e63b3a..f72ca59 100644 --- a/src/download-provider-db.c +++ b/src/download-provider-db.c @@ -1031,6 +1031,7 @@ download_dbinfo *download_provider_db_history_get_info(int requestid) if ((errorcode = sqlite3_step(stmt)) == SQLITE_ROW) { dbinfo = (download_dbinfo *) calloc(1, sizeof(download_dbinfo)); dbinfo->requestid = requestid; + TRACE_DEBUG_INFO_MSG("found id from db [%d]", requestid); buffer = (char *)(sqlite3_column_text(stmt, 0)); dbinfo->packagename = NULL; if (buffer) { diff --git a/src/download-provider-receiver.c b/src/download-provider-receiver.c index ed72158..a2146b5 100644 --- a/src/download-provider-receiver.c +++ b/src/download-provider-receiver.c @@ -392,12 +392,24 @@ int _handle_new_connection(download_clientinfo_slot *clientinfo_list, download_c request_clientinfo->requestinfo->requestid); if (searchindex < 0) { TRACE_DEBUG_INFO_MSG("Not Found Same Request ID"); - // Invalid id - request_clientinfo->state = DOWNLOAD_STATE_FAILED; - request_clientinfo->err = DOWNLOAD_ERROR_INVALID_PARAMETER; - ipc_send_request_stateinfo(request_clientinfo); - clear_clientinfo(request_clientinfo); - return 0; + /* Try to search history db */ + download_dbinfo *dbinfo = download_provider_db_history_get_info( + request_clientinfo->requestinfo->requestid); + if (dbinfo == NULL) { + /* Try to serach downloading db. The crashed job can not be uploaded to memory */ + dbinfo = download_provider_db_get_info( + request_clientinfo->requestinfo->requestid); + if (dbinfo == NULL) { + /* Invalid id */ + request_clientinfo->state = DOWNLOAD_STATE_FAILED; + request_clientinfo->err = DOWNLOAD_ERROR_INVALID_PARAMETER; + ipc_send_request_stateinfo(request_clientinfo); + clear_clientinfo(request_clientinfo); + return 0; + } + } + download_provider_db_info_free(dbinfo); + free(dbinfo); } else { // found request id. // how to deal etag ? // connect to slot. TRACE_DEBUG_INFO_MSG("Found Same Request ID slot[%d]", searchindex); |