开发者

why gen_tcp:controlling_process() can failed with badarg?

I have a problem with one module of ejabberd. It is http_bind. But when I debug deeply I found that after accept socket and spawning hadling开发者_JAVA技巧 process and when reasign process for recieve data for new created process by calling gen_tcp:controlling_process() failed with badarg, WHY?

...

{ok, Socket} = get_tcp:accept(ListenSocket),
Opts = [{active, false}, ...],

% here function return result of proc_lib:spawn_link(handler, ...)
{ok, Pid} = ejabberd_http:start({gen_tcp, Socket}, Opts),

gen_tcp:controlling_process(Socket, Pid),

: {badarg, [
   {erlang, port_connect, [#Port<0.140743856>, <0.5939.4350>]}, 
   {inet, tcp_controlling_process, 2},
   {ejabberd_socket,start,4},
   {ejabberd_listener,accept,3},
   {proc_lib,init_p,5}
]}

any help?


Most probably the socket or the process has crashed before the call to controlling_process.

http://www.erlang.org/doc/man/erlang.html#port_connect-2

Why they would have crashed I don't know, have you made sure that the ejabberd process is running as it should?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜