message process added;

v0.5.xx
Alexander Vdolainen 9 years ago
parent f51d128ac2
commit b76c7610c5

@ -29,5 +29,31 @@
void _message_process(sxmsg_t *msg) void _message_process(sxmsg_t *msg)
{ {
chnl_t *chan = msg->pch;
sexp_t *sx, *isx;
usrtc_t *listrpc = chan->rpc_list->rpc_tree;
usrtc_node_t *node;
cx_rpc_t *rpcc;
int r;
sx = parse_sexp(msg->payload, msg->mhead.payload_length);
if(!sx) sxmsg_return(msg, SNE_BADPROTO);
sexp_list_car(sx, &isx);
if(!isx) { r = SNE_BADPROTO; goto __return_err; }
if(isx->ty == SEXP_LIST) { r = SNE_BADPROTO; goto __return_err; }
if(isx->aty != SEXP_BASIC) { r = SNE_BADPROTO; goto __return_err; }
node = usrtc_lookup(listrpc, (void *)isx->val);
if(!node) { r = SNE_ENORPC; goto __return_err; }
else rpcc = (cx_rpc_t *)usrtc_node_getdata(node);
rpcc->rpcf((void *)msg, sx); /* sx *MUST* be destroy asap */
return;
__return_err:
destroy_sexp(sx);
sxmsg_return(msg, r);
return; return;
} }

Loading…
Cancel
Save