| 305 | } |
| 306 | |
| 307 | static void start_fetch_packed(struct transfer_request *request) |
| 308 | { |
| 309 | struct packed_git *target; |
| 310 | |
| 311 | struct transfer_request *check_request = request_queue_head; |
| 312 | struct http_pack_request *preq; |
| 313 | |
| 314 | target = packfile_list_find_oid(repo->packs.head, &request->obj->oid); |
| 315 | if (!target) { |
| 316 | fprintf(stderr, "Unable to fetch %s, will not be able to update server info refs\n", oid_to_hex(&request->obj->oid)); |
| 317 | repo->can_update_info_refs = 0; |
| 318 | release_request(request); |
| 319 | return; |
| 320 | } |
| 321 | close_pack_index(target); |
| 322 | request->target = target; |
| 323 | |
| 324 | fprintf(stderr, "Fetching pack %s\n", |
| 325 | hash_to_hex(target->hash)); |
| 326 | fprintf(stderr, " which contains %s\n", oid_to_hex(&request->obj->oid)); |
| 327 | |
| 328 | preq = new_http_pack_request(target->hash, repo->url); |
| 329 | if (!preq) { |
| 330 | repo->can_update_info_refs = 0; |
| 331 | return; |
| 332 | } |
| 333 | |
| 334 | /* Make sure there isn't another open request for this pack */ |
| 335 | while (check_request) { |
| 336 | if (check_request->state == RUN_FETCH_PACKED && |
| 337 | !strcmp(check_request->url, preq->url)) { |
| 338 | release_http_pack_request(preq); |
| 339 | release_request(request); |
| 340 | return; |
| 341 | } |
| 342 | check_request = check_request->next; |
| 343 | } |
| 344 | |
| 345 | preq->slot->callback_func = process_response; |
| 346 | preq->slot->callback_data = request; |
| 347 | request->slot = preq->slot; |
| 348 | request->userData = preq; |
| 349 | |
| 350 | /* Try to get the request started, abort the request on error */ |
| 351 | request->state = RUN_FETCH_PACKED; |
| 352 | if (!start_active_slot(preq->slot)) { |
| 353 | fprintf(stderr, "Unable to start GET request\n"); |
| 354 | release_http_pack_request(preq); |
| 355 | repo->can_update_info_refs = 0; |
| 356 | release_request(request); |
| 357 | } |
| 358 | } |
| 359 | |
| 360 | static void start_put(struct transfer_request *request) |
| 361 | { |
no test coverage detected