| 522 | } |
| 523 | |
| 524 | void handle_sync_end(cluster_info_t *cluster, struct local_cap *cap, |
| 525 | int source_id, int no_sync_chunks, int is_timeout) |
| 526 | { |
| 527 | struct buf_bin_pkt *buf_pkt, *buf_tmp; |
| 528 | |
| 529 | /* post-sync phase */ |
| 530 | buf_pkt = cap->pkt_q_front; |
| 531 | while (buf_pkt) { |
| 532 | ipc_dispatch_buf_pkt(buf_pkt, &cap->reg, source_id); |
| 533 | |
| 534 | buf_tmp = buf_pkt; |
| 535 | buf_pkt = buf_pkt->next; |
| 536 | /* do shm_free() instead of bin_free_packet() becuase the buffer |
| 537 | * in bin_packet_t points to the shm buf in struct buf_bin_pkt */ |
| 538 | shm_free(buf_tmp->buf.s); |
| 539 | shm_free(buf_tmp); |
| 540 | } |
| 541 | |
| 542 | cap->pkt_q_front = NULL; |
| 543 | cap->pkt_q_back = NULL; |
| 544 | |
| 545 | /* no more buffered packets to process, stop buffering */ |
| 546 | cap->flags &= ~CAP_SYNC_IN_PROGRESS; |
| 547 | |
| 548 | if (!is_timeout) { |
| 549 | cap->flags |= CAP_STATE_OK; |
| 550 | |
| 551 | sr_set_status(cl_srg, STR2CI(cap->reg.sr_id), CAP_SR_SYNCED, |
| 552 | STR2CI(CAP_SR_STATUS_STR(CAP_SR_SYNCED)), 0); |
| 553 | sr_add_report_fmt(cl_srg, STR2CI(cap->reg.sr_id), 0, |
| 554 | "Sync completed, received [%d] chunks", no_sync_chunks); |
| 555 | |
| 556 | /* inform module that sync is finished; this job is also dispatched */ |
| 557 | ipc_dispatch_buf_pkt(NULL, &cap->reg, source_id); |
| 558 | |
| 559 | /* send update about the state of this capability */ |
| 560 | send_single_cap_update(cluster, cap, 1); |
| 561 | } |
| 562 | } |
| 563 | |
| 564 | void handle_sync_packet(bin_packet_t *packet, int packet_type, |
| 565 | cluster_info_t *cluster, int source_id) |
no test coverage detected