static int start (CcnetProcessor *processor, int argc, char **argv) { if (argc != 2) { g_warning ("[notifysync-slave] argc(%d) must be 2\n", argc); ccnet_processor_done (processor, FALSE); return -1; } const char *repo_id = argv[0]; const char *token = argv[1]; seaf_debug ("[notifysync-slave] Receive notify sync repo %s from %s\n", repo_id, processor->peer_id); if (!seaf_repo_manager_repo_exists (seaf->repo_mgr, repo_id)) { ccnet_processor_send_response (processor, SC_BAD_REPO, SS_BAD_REPO, NULL, 0); ccnet_processor_done (processor, FALSE); return -1; } seaf_sync_manager_add_sync_task (seaf->sync_mgr, repo_id, processor->peer_id, token, TRUE, NULL); ccnet_processor_send_response (processor, SC_OK, SS_OK, NULL, 0); ccnet_processor_done (processor, TRUE); return 0; }
static int start (CcnetProcessor *processor, int argc, char **argv) { char *session_token; USE_PRIV; if (argc != 1) { ccnet_processor_send_response (processor, SC_BAD_ARGS, SS_BAD_ARGS, NULL, 0); ccnet_processor_done (processor, FALSE); return -1; } session_token = argv[0]; if (seaf_token_manager_verify_token (seaf->token_mgr, processor->peer_id, session_token, NULL) == 0) { ccnet_processor_send_response (processor, SC_OK, SS_OK, NULL, 0); processor->state = RECV_ROOT; priv->dir_queue = g_queue_new (); register_async_io (processor); return 0; } else { ccnet_processor_send_response (processor, SC_ACCESS_DENIED, SS_ACCESS_DENIED, NULL, 0); ccnet_processor_done (processor, FALSE); return -1; } }
static void thread_done (void *result) { CcnetProcessor *processor = result; USE_PRIV; if (processor->delay_shutdown) { ccnet_processor_done (processor, FALSE); return; } if (strcmp (priv->rsp_code, SC_OK) == 0) { if (priv->has_branch) { ccnet_processor_send_response (processor, SC_OK, SS_OK, priv->head_id, 41); } else ccnet_processor_send_response (processor, SC_OK, SS_OK, NULL, 0); processor->state = ACCESS_GRANTED; } else { ccnet_processor_send_response (processor, priv->rsp_code, priv->rsp_msg, NULL, 0); ccnet_processor_done (processor, FALSE); } }
static void computation_finished (CcnetProcessor *processor, int status, char *message) { USE_PRIV; g_ptr_array_free (priv->block_ids, TRUE); priv->block_ids = NULL; g_message ("Finished computing size of repo %s.\n", priv->repo_id); /* Store repo size into database. */ if (seaf_monitor_set_repo_size (singleton_monitor, priv->repo_id, priv->repo_size, priv->is_accurate, priv->head) < 0) { ccnet_processor_send_response (processor, SC_DB_ERROR, SS_DB_ERROR, NULL, 0); ccnet_processor_done (processor, FALSE); } ccnet_processor_send_response (processor, SC_FINISHED, SS_FINISHED, NULL, 0); ccnet_processor_done (processor, TRUE); }
static int start (CcnetProcessor *processor, int argc, char **argv) { USE_PRIV; if (argc != 2 || strlen(argv[0]) != 36 || strlen(argv[1]) != 40) { ccnet_processor_send_response (processor, SC_BAD_ARGS, SS_BAD_ARGS, NULL, 0); ccnet_processor_done (processor, FALSE); return -1; } if (seaf_monitor_is_repo_size_uptodate (singleton_monitor, argv[0], argv[1])) { g_message ("repo size %s is up-to-date.\n", argv[0]); ccnet_processor_send_response (processor, SC_FINISHED, SS_FINISHED, NULL, 0); ccnet_processor_done (processor, TRUE); return 0; } memcpy (priv->repo_id, argv[0], 41); memcpy (priv->head, argv[1], 41); priv->block_ids = g_ptr_array_new_with_free_func (g_free); priv->is_accurate = 1; ccnet_processor_send_response (processor, SC_OK, SS_OK, NULL, 0); return 0; }
static void thread_done (void *result) { CcnetProcessor *processor = result; USE_PRIV; if (processor->delay_shutdown) { ccnet_processor_done (processor, FALSE); return; } if (strcmp (priv->rsp_code, SC_OK) == 0) { /* Repo is updated, trigger repo size computation. */ if (seaf->monitor_id != NULL && (strcmp (seaf->monitor_id, seaf->session->base.id) == 0 || ccnet_peer_is_ready (seaf->ccnetrpc_client, seaf->monitor_id))) { monitor_compute_repo_size_async_wrapper (seaf->monitor_id, priv->repo_id, compute_callback, NULL); } ccnet_processor_send_response (processor, SC_OK, SS_OK, NULL, 0); ccnet_processor_done (processor, TRUE); } else { ccnet_processor_send_response (processor, priv->rsp_code, priv->rsp_msg, NULL, 0); ccnet_processor_done (processor, FALSE); } }
static int put_commit_start (CcnetProcessor *processor, int argc, char **argv) { char *commit_id; char *session_token; USE_PRIV; if (argc != 2) { ccnet_processor_send_response (processor, SC_BAD_ARGS, SS_BAD_ARGS, NULL, 0); ccnet_processor_done (processor, FALSE); return -1; } session_token = argv[1]; if (seaf_token_manager_verify_token (seaf->token_mgr, processor->peer_id, session_token, NULL) < 0) { ccnet_processor_send_response (processor, SC_ACCESS_DENIED, SS_ACCESS_DENIED, NULL, 0); ccnet_processor_done (processor, FALSE); return -1; } commit_id = argv[0]; memcpy (priv->commit_id, commit_id, 41); ccnet_processor_send_response (processor, SC_OK, SS_OK, NULL, 0); return send_commit_ids (processor, commit_id); }
static void response_challenge_user(CcnetProcessor *processor, char *code, char *code_msg, char *content, int clen) { unsigned char *buf; int decrypt_len; if (clen == 0) { ccnet_warning("Peer %s(%.8s) send bad format challenge\n", processor->peer->name, processor->peer->id); ccnet_processor_send_response ( processor, SC_BAD_CHALLENGE, SS_BAD_CHALLENGE, NULL, 0); ccnet_processor_done(processor, FALSE); return; } buf = private_key_decrypt(processor->session->user_privkey, (unsigned char *)content, clen, &decrypt_len); if (decrypt_len < 0) { ccnet_processor_send_response ( processor, SC_DECRYPT_ERROR, SS_DECRYPT_ERROR, NULL, 0); ccnet_processor_done(processor, FALSE); } else ccnet_processor_send_response ( processor, code, "", (char *)buf, decrypt_len); g_free(buf); }
static int send_repo_branch_info (CcnetProcessor *processor, const char *repo_id, const char *branch) { SeafRepo *repo; SeafBranch *seaf_branch; repo = seaf_repo_manager_get_repo (seaf->repo_mgr, repo_id); if (!repo) { ccnet_processor_send_response (processor, SC_NO_REPO, SS_NO_REPO, NULL, 0); return 0; } seaf_branch = seaf_branch_manager_get_branch (seaf->branch_mgr, repo_id, branch); if (seaf_branch == NULL) { ccnet_processor_send_response (processor, SC_NO_BRANCH, SS_NO_BRANCH, NULL, 0); return -1; } ccnet_processor_send_response (processor, SC_COMMIT_ID, SS_COMMIT_ID, seaf_branch->commit_id, 41); seaf_branch_unref (seaf_branch); return 0; }
static void thread_done (void *result) { CcnetProcessor *processor = result; USE_PRIV; if (strcmp (priv->rsp_code, SC_OK) == 0) { if (priv->has_branch) { ccnet_processor_send_response (processor, SC_OK, SS_OK, priv->head_id, 41); } else ccnet_processor_send_response (processor, SC_OK, SS_OK, NULL, 0); processor->state = ACCESS_GRANTED; if (priv->type == CHECK_TX_TYPE_DOWNLOAD) publish_repo_event (processor, "repo-download-sync"); else if (priv->type == CHECK_TX_TYPE_UPLOAD) publish_repo_event (processor, "repo-upload-sync"); } else { ccnet_processor_send_response (processor, priv->rsp_code, priv->rsp_msg, NULL, 0); ccnet_processor_done (processor, FALSE); } }
void ccnet_service_proxy_invoke_remote (CcnetProcessor *processor, CcnetPeer *remote, int argc, char **argv) { CcnetServiceStubProc *stub_proc; ServiceProxyPriv *priv = GET_PRIV(processor); if (argc < 1) { ccnet_processor_send_response (processor, SC_BAD_CMD_FMT, SS_BAD_CMD_FMT, NULL, 0); ccnet_processor_done (processor, FALSE); return; } priv->name = proc_name_strjoin_n(" ", argc, argv); stub_proc = CCNET_SERVICE_STUB_PROC ( ccnet_proc_factory_create_master_processor ( processor->session->proc_factory, "service-stub", remote) ); priv->stub_proc = stub_proc; ccnet_service_stub_proc_set_proxy_proc (stub_proc, processor); /* Start can fail if the remote end is not connected. */ if (ccnet_processor_start (CCNET_PROCESSOR(stub_proc), argc, argv) < 0) { ccnet_processor_send_response (processor, SC_PROC_DEAD, SS_PROC_DEAD, NULL, 0); ccnet_processor_done (processor, FALSE); } }
static void process_object_list_done (void *data) { CcnetProcessor *processor = data; USE_PRIV; if (priv->n_needed == 0) { ccnet_processor_send_response (processor, SC_OBJ_LIST_SEG, SS_OBJ_LIST_SEG, NULL, 0); return; } char *buf = g_malloc (priv->n_needed * 40); char *p; char *obj_id; GList *ptr; p = buf; for (ptr = priv->needed_objs; ptr; ptr = ptr->next) { obj_id = ptr->data; memcpy (p, obj_id, 40); p += 40; } ccnet_processor_send_response (processor, SC_OBJ_LIST_SEG, SS_OBJ_LIST_SEG, buf, priv->n_needed * 40); g_free (buf); string_list_free (priv->needed_objs); priv->needed_objs = NULL; priv->n_needed = 0; }
static int start (CcnetProcessor *processor, int argc, char **argv) { char *session_token; USE_PRIV; if (argc != 1) { ccnet_processor_send_response (processor, SC_BAD_ARGS, SS_BAD_ARGS, NULL, 0); ccnet_processor_done (processor, FALSE); return -1; } session_token = argv[0]; if (seaf_token_manager_verify_token (seaf->token_mgr, NULL, processor->peer_id, session_token, priv->repo_id) == 0) { ccnet_processor_thread_create (processor, seaf->job_mgr, get_repo_info_thread, get_repo_info_done, processor); return 0; } else { ccnet_processor_send_response (processor, SC_ACCESS_DENIED, SS_ACCESS_DENIED, NULL, 0); ccnet_processor_done (processor, FALSE); return -1; } }
static gboolean send_commit (CcnetProcessor *processor, char *object_id) { char *data; int len; ObjectPack *pack = NULL; int pack_size; if (seaf_obj_store_read_obj (seaf->commit_mgr->obj_store, object_id, (void**)&data, &len) < 0) { g_warning ("Failed to read commit %s.\n", object_id); goto fail; } pack_size = sizeof(ObjectPack) + len; pack = malloc (pack_size); memcpy (pack->id, object_id, 41); memcpy (pack->object, data, len); ccnet_processor_send_response (processor, SC_OBJECT, SS_OBJECT, (char *)pack, pack_size); g_free (data); free (pack); return TRUE; fail: ccnet_processor_send_response (processor, SC_NOT_FOUND, SS_NOT_FOUND, object_id, 41); ccnet_processor_done (processor, FALSE); return FALSE; }
static int start (CcnetProcessor *processor, int argc, char **argv) { USE_PRIV; if (processor->peer->session_key) { ccnet_processor_send_response (processor, SC_ALREADY_HAS_KEY, SS_ALREADY_HAS_KEY, NULL, 0); ccnet_processor_done (processor, FALSE); return -1; } if (argc == 1 && g_strcmp0(argv[0], "--enc-channel") == 0) priv->encrypt_channel = 1; else priv->encrypt_channel = 0; ccnet_processor_send_response (processor, SC_SESSION_KEY, SS_SESSION_KEY, NULL, 0); return 0; }
static void receive_keepalive(CcnetProcessor *processor, char *code, char *code_msg, char *content, int clen) { CcnetPeer *peer = processor->peer; if (clen == 0 || content[clen-1] != '\0' || content[clen-2] != '\n') { ccnet_processor_send_response ( processor, SC_BAD_KEEPALIVE, SS_BAD_KEEPALIVE, NULL, 0); ccnet_processor_done (processor, FALSE); return; } parse_key_value_pairs (content, update_from_key_value, peer); /* ccnet_debug ("[Keepalive] Receive keepalive from %.8s #%s\n", */ /* processor->peer->id, code_msg); */ ccnet_processor_send_response ( processor, code, code_msg, NULL, 0); /* Peer discovered us, so we try to discover peer too. * Used in indirect connection vie Relay */ /* if (peer->net_state == PEER_DOWN && peer->relay_list != NULL) { if (!peer->keepalive_sending) start_keepalive (processor->session->proc_factory, peer); } */ }
static void read_done_cb (OSAsyncResult *res, void *cb_data) { CcnetProcessor *processor = cb_data; USE_PRIV; if (!res->success) { g_warning ("[putcommit] Failed to read %s.\n", res->obj_id); goto bad; } send_commit (processor, res->obj_id, res->data, res->len); seaf_debug ("Send commit %.8s.\n", res->obj_id); /* Send next commit. */ if (priv->id_list != NULL) read_and_send_commit (processor); else { ccnet_processor_send_response (processor, SC_END, SS_END, NULL, 0); ccnet_processor_done (processor, TRUE); } return; bad: ccnet_processor_send_response (processor, SC_NOT_FOUND, SS_NOT_FOUND, NULL, 0); ccnet_processor_done (processor, FALSE); }
static void queue_fs_roots (CcnetProcessor *processor, char *content, int clen) { USE_PRIV; char *object_id; int n_objects; int i; if (clen % 41 != 0) { seaf_warning ("Bad fs root list.\n"); ccnet_processor_send_response (processor, SC_BAD_OL, SS_BAD_OL, NULL, 0); ccnet_processor_done (processor, FALSE); return; } n_objects = clen/41; object_id = content; for (i = 0; i < n_objects; ++i) { object_id[40] = '\0'; priv->fs_roots = g_list_prepend (priv->fs_roots, g_strdup(object_id)); object_id += 41; ++(priv->n_roots); } ccnet_processor_send_response (processor, SC_OK, SS_OK, NULL, 0); }
static void process_get_block (CcnetProcessor *processor, char *content, int clen) { char *space, *block_id; USE_PRIV; if (content[clen-1] != '\0') { ccnet_processor_send_response (processor, SC_BAD_BLK_REQ, SS_BAD_BLK_REQ, NULL, 0); ccnet_processor_done (processor, FALSE); return; } space = strchr (content, ' '); if (!space) { ccnet_processor_send_response (processor, SC_BAD_BLK_REQ, SS_BAD_BLK_REQ, NULL, 0); ccnet_processor_done (processor, FALSE); return; } *space = '\0'; block_id = space + 1; BlockRequest req; req.block_idx = atoi(content); memcpy (req.block_id, block_id, 41); if (pipewriten (priv->tdata->task_pipe[1], &req, sizeof(BlockRequest)) < 0) { g_warning ("[put block] failed to write task pipe.\n"); ccnet_processor_done (processor, FALSE); } }
static int recv_commit_start (CcnetProcessor *processor, int argc, char **argv) { USE_PRIV; char *session_token; if (argc != 2) { ccnet_processor_send_response (processor, SC_BAD_ARGS, SS_BAD_ARGS, NULL, 0); ccnet_processor_done (processor, FALSE); return -1; } session_token = argv[1]; if (seaf_token_manager_verify_token (seaf->token_mgr, processor->peer_id, session_token, NULL) == 0) { ccnet_processor_send_response (processor, SC_OK, SS_OK, NULL, 0); processor->state = RECV_OBJECT; priv->writer_id = seaf_obj_store_register_async_write (seaf->commit_mgr->obj_store, write_done_cb, processor); priv->registered = TRUE; return 0; } else { ccnet_processor_send_response (processor, SC_ACCESS_DENIED, SS_ACCESS_DENIED, NULL, 0); ccnet_processor_done (processor, FALSE); return -1; } }
static int put_commit_start (CcnetProcessor *processor, int argc, char **argv) { char *head_id, *remote_id = NULL; char *session_token; USE_PRIV; if (argc < 2) { ccnet_processor_send_response (processor, SC_BAD_ARGS, SS_BAD_ARGS, NULL, 0); ccnet_processor_done (processor, FALSE); return -1; } if (argc == 2) { head_id = argv[0]; session_token = argv[1]; } else if (argc >= 3) { head_id = argv[0]; remote_id = argv[1]; session_token = argv[2]; } if (strlen(head_id) != 40 || (remote_id && strlen(remote_id) != 40)) { ccnet_processor_send_response (processor, SC_BAD_ARGS, SS_BAD_ARGS, NULL, 0); ccnet_processor_done (processor, FALSE); return -1; } if (seaf_token_manager_verify_token (seaf->token_mgr, processor->peer_id, session_token, NULL) < 0) { ccnet_processor_send_response (processor, SC_ACCESS_DENIED, SS_ACCESS_DENIED, NULL, 0); ccnet_processor_done (processor, FALSE); return -1; } memcpy (priv->head_commit_id, head_id, 41); if (remote_id != NULL) memcpy (priv->remote_commit_id, remote_id, 41); ccnet_processor_send_response (processor, SC_OK, SS_OK, NULL, 0); priv->reader_id = seaf_obj_store_register_async_read (seaf->commit_mgr->obj_store, read_done_cb, processor); priv->registered = TRUE; ccnet_processor_thread_create (processor, seaf->job_mgr, collect_commit_id_thread, collect_commit_id_done, processor); return 0; }
static void handle_update (CcnetProcessor *processor, char *code, char *code_msg, char *content, int clen) { USE_PRIV; if (strcmp(code, SC_SESSION_KEY) == 0) { if (processor->peer->session_key) { ccnet_processor_send_response (processor, SC_ALREADY_HAS_KEY, SS_ALREADY_HAS_KEY, NULL, 0); ccnet_processor_done (processor, TRUE); return; } if (update_peer_session_key (processor->peer, content, clen) < 0) { ccnet_processor_send_response (processor, SC_BAD_KEY, SS_BAD_KEY, NULL, 0); ccnet_processor_done (processor, FALSE); return; } if (priv->encrypt_channel) { /* peer ask to encrypt channel, check whether we want it too */ if (ccnet_session_should_encrypt_channel(processor->session)) { /* send the ok reply first */ ccnet_processor_send_response (processor, SC_OK, SS_OK, NULL, 0); /* now setup encryption */ if (ccnet_peer_prepare_channel_encryption (processor->peer) < 0) /* this is very rare, we just print a warning */ ccnet_warning ("Error in prepare channel encryption\n"); } else ccnet_processor_send_response ( processor, SC_NO_ENCRYPT, SS_NO_ENCRYPT, NULL, 0); } else ccnet_processor_send_response ( processor, SC_OK, SS_OK, NULL, 0); ccnet_peer_manager_on_peer_session_key_received (processor->peer->manager, processor->peer); ccnet_processor_done (processor, TRUE); return; } ccnet_warning ("[recv session key] bad update %s:%s\n", code, code_msg); ccnet_processor_done (processor, FALSE); }
static int send_commit_ids (CcnetProcessor *processor, const char *head) { char buf[2048]; char *ptr = buf; int i, count = 0; int ret; ObjectList *ol = object_list_new (); ret = seaf_commit_manager_traverse_commit_tree (seaf->commit_mgr, head, commit_collector, ol); if (ret == FALSE) { object_list_free (ol); g_warning ("[putcommit] Load commits error\n"); ccnet_processor_send_response ( processor, SC_NOT_FOUND, SS_NOT_FOUND, NULL, 0); ccnet_processor_done (processor, FALSE); return -1; } int ollen = object_list_length(ol); g_assert (ollen != 0); for (i = 0; i < ollen; i++) { memcpy (ptr, g_ptr_array_index(ol->obj_ids, i), 40); ptr += 40; *ptr++ = '\n'; if (++count == 48) { *ptr = '\0'; g_debug ("[putcommit] Send commit ids:\n%s", buf); ccnet_processor_send_response (processor, SC_COMMIT_IDS, SS_COMMIT_IDS, buf, 41 * count + 1); ptr = buf; count = 0; } } if (count) { *ptr = '\0'; g_debug ("[putcommit] Send commit ids:\n%s", buf); ccnet_processor_send_response (processor, SC_COMMIT_IDS, SS_COMMIT_IDS, buf, 41 * count + 1); } g_debug ("[putcommit] Sent commit ids.\n"); ccnet_processor_send_response (processor, SC_END, SS_END, NULL, 0); return 0; }
static void write_done_cb (OSAsyncResult *res, void *cb_data) { CcnetProcessor *processor = cb_data; if (!res->success) { ccnet_processor_send_response (processor, SC_BAD_OBJECT, SS_BAD_OBJECT, NULL, 0); g_warning ("[recvcommit] Failed to write commit object.\n"); ccnet_processor_done (processor, FALSE); } else { ccnet_processor_send_response (processor, SC_ACK, SS_ACK, NULL, 0); } }
static void get_repo_info_done (void *data) { CcnetProcessor *processor = data; USE_PRIV; if (priv->success) { ccnet_processor_send_response (processor, SC_OK, SS_OK, NULL, 0); register_async_io (processor); } else { ccnet_processor_send_response (processor, SC_SHUTDOWN, SS_SHUTDOWN, NULL, 0); ccnet_processor_done (processor, FALSE); } }
static void handle_update (CcnetProcessor *processor, char *code, char *code_msg, char *content, int clen) { USE_PRIV; switch (priv->tdata->state) { case PREPARE: if (memcmp (code, SC_BLOCKLIST, 3) == 0) { process_block_list (processor, content, clen); return; } else if (memcmp (code, SC_GET_PORT, 3) == 0) { send_port (processor); return; } break; case READY: if (memcmp (code, SC_GET_BLOCK, 3) == 0) { process_get_block (processor, content, clen); return; } break; } g_warning ("Bad code: %s %s\n", code, code_msg); ccnet_processor_send_response (processor, SC_BAD_UPDATE_CODE, SS_BAD_UPDATE_CODE, NULL, 0); ccnet_processor_done (processor, FALSE); }
int ccnet_processor_start (CcnetProcessor *processor, int argc, char **argv) { /* set this value to now even if this is a master processor and has not received any packet yet for simplifying the keepalive logic. */ g_assert (processor->start_time == 0); time_t now = time(NULL); processor->start_time = now; if (IS_SLAVE(processor)) processor->t_packet_recv = now; else processor->t_packet_recv = 0; processor->failure = PROC_NOTSET; if (processor->peer->net_state != PEER_CONNECTED) { if (IS_SLAVE(processor)) { ccnet_processor_send_response (processor, SC_NETDOWN, SS_NETDOWN, NULL, 0); } processor->failure = PROC_NETDOWN; ccnet_processor_done (processor, FALSE); return -1; } return CCNET_PROCESSOR_GET_CLASS (processor)->start ( processor, argc, argv); }
static void send_commits (CcnetProcessor *processor, char *content, int clen) { char *object_id; int n_objects; int i; if (clen % 41 != 1 || content[clen-1] != '\0') { g_warning ("[putcommit] Bad fs object list.\n"); ccnet_processor_send_response (processor, SC_BAD_OL, SS_BAD_OL, NULL, 0); ccnet_processor_done (processor, FALSE); return; } n_objects = clen/41; g_debug ("[putcommit] send commit objects %d:\n%s", n_objects, content); object_id = content; for (i = 0; i < n_objects; ++i) { object_id[40] = '\0'; g_debug ("[putcommit] send commit object #%d:%s\n", i, object_id); if (send_commit (processor, object_id) == FALSE) return; object_id += 41; } }
static int block_proc_start (CcnetProcessor *processor, int argc, char **argv) { if (verify_session_token (processor, argc, argv) < 0) { ccnet_processor_send_response (processor, SC_ACCESS_DENIED, SS_ACCESS_DENIED, NULL, 0); ccnet_processor_done (processor, FALSE); return -1; } prepare_thread_data(processor, recv_blocks, recv_block_cb); ccnet_processor_send_response (processor, "200", "OK", NULL, 0); return 0; }
static int sync_repo_slave_start (CcnetProcessor *processor, int argc, char **argv) { USE_PRIV; if (argc != 2) { g_warning ("[sync-repo-slave] argc(%d) must be 2\n", argc); ccnet_processor_done (processor, FALSE); return -1; } memcpy (priv->repo_id, argv[0], 37); priv->branch_name = g_strdup (argv[1]); /* send the head commit of the branch */ if (ccnet_processor_thread_create (processor, seaf->job_mgr, send_repo_branch_info, thread_done, processor) < 0) { g_warning ("[sync repo] failed to start thread.\n"); ccnet_processor_send_response (processor, SC_SERVER_ERROR, SS_SERVER_ERROR, NULL, 0); ccnet_processor_done (processor, FALSE); return -1; } return 0; }