forked from lei.chen/myxce
push more to api server
This commit is contained in:
parent
00d161aa11
commit
44fc5b23e9
4 changed files with 501 additions and 34 deletions
|
|
@ -117,21 +117,33 @@ static int handle_controller_join(cluster_t* c, endpoint_t* ep,
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int handle_apiserver_join(cluster_t *c, endpoint_t *ep, xce_request_t *request) {
|
||||
xce_reply_t reply;
|
||||
ep_private_t *priv = (ep_private_t *)ep->data;
|
||||
int rc = 0;
|
||||
static int handle_apiserver_join(cluster_t* c, endpoint_t* ep,
|
||||
xce_request_t* request)
|
||||
{
|
||||
xce_reply_t reply;
|
||||
xce_peerinfo_t* from = request->from;
|
||||
int rc = 0;
|
||||
|
||||
TRACE("%s api server join, ep %p", __func__, ep);
|
||||
|
||||
init_reply_by_req(&reply, request);
|
||||
|
||||
rc = on_apiserver_join(c, ep);
|
||||
rc = add_apiserver(c, from->name, ep);
|
||||
if (rc >= 0) {
|
||||
ep_private_t* priv = (ep_private_t*)ep->data;
|
||||
|
||||
reply.status = rc;
|
||||
priv->u.idx = rc;
|
||||
on_apiserver_join(c, ep);
|
||||
}
|
||||
|
||||
reply.status = rc;
|
||||
reply.data_which = RequestReply_data_nodata;
|
||||
xce_reply(ep, c->myhost, &reply);
|
||||
|
||||
if (rc < 0) {
|
||||
ERROR("api server %s join failed, rc %d", from->name, rc);
|
||||
return rc;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue