| 92 | } |
| 93 | |
| 94 | int queue_sync_request(cluster_info_t *cluster, struct local_cap *lcap) |
| 95 | { |
| 96 | lock_get(cluster->lock); |
| 97 | lcap->flags |= CAP_SYNC_PENDING; |
| 98 | if (sr_get_core_status() == STATE_INITIALIZING) |
| 99 | lcap->flags |= CAP_SYNC_STARTUP; |
| 100 | else |
| 101 | lcap->flags &= ~CAP_SYNC_STARTUP; |
| 102 | |
| 103 | if (cluster->current_node->flags & NODE_IS_SEED) |
| 104 | gettimeofday(&lcap->sync_req_time, NULL); |
| 105 | |
| 106 | lock_release(cluster->lock); |
| 107 | |
| 108 | LM_INFO("Queue'ing sync request for capability '%.*s' in cluster %d " |
| 109 | "(no donor available)\n", lcap->reg.name.len, lcap->reg.name.s, |
| 110 | cluster->cluster_id); |
| 111 | |
| 112 | sr_set_status(cl_srg, STR2CI(lcap->reg.sr_id), CAP_SR_SYNC_PENDING, |
| 113 | STR2CI(CAP_SR_STATUS_STR(CAP_SR_SYNC_PENDING)), 0); |
| 114 | if (sr_add_report_fmt(cl_srg, STR2CI(lcap->reg.sr_id), 0, |
| 115 | "Sync request postponed! (no donor available)")) |
| 116 | return -1; |
| 117 | |
| 118 | return 0; |
| 119 | } |
| 120 | |
| 121 | int cl_request_sync(str *capability, int cluster_id, int from_cb) |
| 122 | { |
no test coverage detected