[sr-dev] some pua_rpc progress
Daniel-Constantin Mierla
miconda at gmail.com
Thu Dec 4 13:28:53 CET 2014
It seems you change the value of c inside publish:
if (dctx->reply_ctx != 0) {
/* callback was not executed or its execution failed */
rpc = &dctx->rpc;
c = dctx->reply_ctx;
} else {
return;
}
So it is no longer pointing to the same structure as in dispatch_rpc().
Cheers,
Daniel
On 04/12/14 05:01, Juha Heinanen wrote:
> Daniel-Constantin Mierla writes:
>
>> It was more to see if it is still sent inside xmlrpc_dispatch() --
>> perhaps you can add a log message there before rpc_send()
> i added this debug to xmlrpc/dispatch_rpc():
>
> skip:
> /* The function may have sent the reply itself */
> if (!ctx.reply_sent)
> LM_INFO("function did not sent reply\n");
>
> if (!(ctx.flags&XMLRPC_DELAYED_REPLY_F))
> LM_INFO("XMLRPC_DELAYED_REPLY_F is not set\n");
>
> if (!ctx.reply_sent && !(ctx.flags&XMLRPC_DELAYED_REPLY_F)) {
> ret = rpc_send(&ctx);
> }
>
> and got:
>
> Dec 4 05:55:58 rautu /usr/bin/sip-proxy[3592]: INFO: pua_rpc [pua_rpc.c:222]: publish(): pua_send_publish returned 418
> Dec 4 05:55:58 rautu /usr/bin/sip-proxy[3592]: INFO: xmlrpc [xmlrpc.c:920]: rpc_fault(): running rpc_fault '500'/'Wrong ETag'
> Dec 4 05:55:58 rautu /usr/bin/sip-proxy[3592]: INFO: xmlrpc [xmlrpc.c:2443]: dispatch_rpc(): function did not sent reply
>
> so looks like if callback function is not executed and
>
> rpc->fault(c, 500, "Wrong ETag");
>
> executed from the main function, dispatch_rpc() does not get to know
> about it.
>
> -- juha
>
> static void publish(rpc_t* rpc, void* c)
> ...
>
> dctx = rpc->delayed_ctx_new(c);
> if (dctx == 0) {
> LM_ERR("internal error: failed to create context\n");
> rpc->fault(c, 500, "internal error: failed to create context");
> return;
> }
>
> publ.cb_param = dctx;
> publ.source_flag = MI_ASYN_PUBLISH;
>
> ret = pua_send_publish(&publ);
> LM_INFO("pua_send_publish returned %d\n", ret);
>
> if (dctx->reply_ctx != 0) {
> /* callback was not executed or its execution failed */
> rpc = &dctx->rpc;
> c = dctx->reply_ctx;
> } else {
> return;
> }
>
> if (ret < 0) {
> LM_ERR("pua_send_publish failed\n");
> err_ret = err2reason_phrase(ret, &sip_error, err_buf,
> sizeof(err_buf), "RPC/PUBLISH") ;
> if (err_ret > 0 ) {
> rpc->fault(c, sip_error, "%s", err_buf);
> } else {
> rpc->fault(c, 500, "RPC/PUBLISH error");
> }
> rpc->delayed_ctx_close(dctx);
> }
>
> if (ret == 418) {
> rpc->fault(c, 500, "Wrong ETag");
> rpc->delayed_ctx_close(dctx);
> }
>
>
> return;
> }
--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
More information about the sr-dev
mailing list