diff options
author | Bang Kwang min <justine.bang@samsung.com> | 2012-09-05 09:18:58 +0900 |
---|---|---|
committer | Bang Kwang min <justine.bang@samsung.com> | 2012-09-05 14:46:21 +0900 |
commit | 08a0ee323b749b84d7e6d92d863a9777beaaf8b2 (patch) | |
tree | bbc8a3d361a1ed26b4662dad14e4b99e8d35e4a2 | |
parent | 63e531db43e1505c51015b4af2f3d3519731621b (diff) | |
download | download-provider-08a0ee323b749b84d7e6d92d863a9777beaaf8b2.tar.gz download-provider-08a0ee323b749b84d7e6d92d863a9777beaaf8b2.tar.bz2 download-provider-08a0ee323b749b84d7e6d92d863a9777beaaf8b2.zip |
start to download again even if already finished
[Title] start to download again when job having same requestid was already finished
[Issue#] N/A
[Problem] no operation if already finished
[Cause] N/A
[Solution] N/A
[SCMRequest] N/A
Change-Id: I6f528cb595a9398ffc7f2e2d0169cd7d9769eb4a
-rw-r--r-- | src/download-provider-receiver.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/download-provider-receiver.c b/src/download-provider-receiver.c index 3a06667..ed72158 100644 --- a/src/download-provider-receiver.c +++ b/src/download-provider-receiver.c @@ -408,7 +408,6 @@ int _handle_new_connection(download_clientinfo_slot *clientinfo_list, download_c // change to new socket. clientinfo_list[searchindex].clientinfo->clientfd = request_clientinfo->clientfd; - ipc_send_request_stateinfo(clientinfo_list[searchindex].clientinfo); // update some info. clientinfo_list[searchindex].clientinfo->requestinfo->callbackinfo = request_clientinfo->requestinfo->callbackinfo; @@ -417,6 +416,21 @@ int _handle_new_connection(download_clientinfo_slot *clientinfo_list, download_c request_clientinfo->clientfd = 0; // prevent to not be disconnected. CLIENT_MUTEX_UNLOCK(&(request_clientinfo->client_mutex)); clear_clientinfo(request_clientinfo); + + if (clientinfo_list[searchindex].clientinfo->state + == DOWNLOAD_STATE_READY + || clientinfo_list[searchindex].clientinfo->state + >= DOWNLOAD_STATE_FINISHED) { + active_count = get_downloading_count(clientinfo_list); + if (active_count >= DA_MAX_DOWNLOAD_REQ_AT_ONCE) { + // deal as pended job. + _change_pended_download(clientinfo_list[searchindex].clientinfo); + TRACE_DEBUG_INFO_MSG ("Pended Request is saved to [%d/%d]", + searchslot, MAX_CLIENT); + } else + _create_download_thread(&clientinfo_list[searchindex]); + } else + ipc_send_request_stateinfo(clientinfo_list[searchindex].clientinfo); return 0; } } |