void S3KeyWriter::checkQueryCancelSignal() { if (S3QueryIsAbortInProgress() && !this->uploadId.empty()) { // to avoid dead-lock when other upload threads hold the lock pthread_mutex_unlock(&this->mutex); // wait for all threads to complete for (size_t i = 0; i < threadList.size(); i++) { pthread_join(threadList[i], NULL); } this->threadList.clear(); // to avoid double unlock as other parts may lock it pthread_mutex_lock(&this->mutex); S3DEBUG("Start aborting multipart uploading (uploadID: %s, %lu parts uploaded)", this->uploadId.c_str(), this->etagList.size()); this->s3Interface->abortUpload(this->params.getS3Url(), this->uploadId); S3DEBUG("Finished aborting multipart uploading (uploadID: %s)", this->uploadId.c_str()); this->etagList.clear(); this->uploadId.clear(); S3_DIE(S3QueryAbort, "Uploading is interrupted"); } }
void S3RESTfulService::performCurl(CURL *curl, Response &response) { CURLcode res = curl_easy_perform(curl); if (res != CURLE_OK) { if (res == CURLE_COULDNT_RESOLVE_HOST) { S3_DIE(S3ResolveError, curl_easy_strerror(res)); } else { S3_DIE(S3ConnectionError, curl_easy_strerror(res)); } } else { long responseCode; // Get the HTTP response status code from HTTP header curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &responseCode); if (responseCode == 500) { S3_DIE(S3ConnectionError, "Server temporary unavailable"); } response.FillResponse(responseCode); } }