[erlang-bugs] Bug in ssl:controlling_process?

Ingela Anderton Andin ingela.anderton.andin@REDACTED
Wed Sep 26 14:35:13 CEST 2012


Hi!

I think you are right, we will add the missing clause.

Regards Ingela Erlang/OTP team - Ericsson AB

Andrew Thompson wrote:
> 3> {ok, S} = ssl:listen(0, [{certfile, "cert.pem"}]).
> {ok,{sslsocket,new_ssl,
>                {#Port<0.667>,
>                 {config,{ssl_options,[],verify_none,
>                                      {#Fun<ssl.1.54384637>,[]},
>                                      false,false,undefined,1,
>                                      "cert.pem",
>                                      undefined,
>                                      "cert.pem",
>                                      undefined,[],undefined,[],undefined,undefined,
>                                      [<<0,...>>,<<...>>|...],
>                                      #Fun<ssl.0.54384637>,true,...},
>                         [],
>                         {socket_options,list,0,0,0,true},
>                         [{packet_size,0},
>                          {packet,0},
>                          {header,0},
>                          {active,false},
>                          {mode,binary}],
>                         {gen_tcp,tcp,tcp_closed,tcp_error}}}}}
> 4> ssl:controlling_process(S, self()).
> ** exception error: no function clause matching ssl:controlling_process({sslsocket,new_ssl,
>                                                                                    {#Port<0.667>,
>                                                                                     {config,{ssl_options,[],verify_none,
>                                                                                                          {#Fun<ssl.1.54384637>,[]},
>                                                                                                          false,false,undefined,1,
>                                                                                                          "cert.pem",
>                                                                                                          undefined,
>                                                                                                          "cert.pem",
>                                                                                                          undefined,[],undefined,[],undefined,undefined,
>                                                                                                          [<<0,57>>,<<0,...>>,<<...>>|...],
>                                                                                                          #Fun<ssl.0.54384637>,true,268435456,...},
>                                                                                             [],
>                                                                                             {socket_options,list,0,0,0,true},
>                                                                                             [{packet_size,0},
>                                                                                              {packet,0},
>                                                                                              {header,0},
>                                                                                              {active,false},
>                                                                                              {mode,binary}],
>                                                                                             {gen_tcp,tcp,tcp_closed,tcp_error}}}},
>                                                                         <0.36.0>) (ssl.erl, line 273)
>
> ssl:controlling_process reads as follows:
>
> controlling_process(#sslsocket{pid = Pid}, NewOwner) when is_pid(Pid) ->
>     ssl_connection:new_user(Pid, NewOwner).
>
> But, in the sslsocket, pid is NOT a pid, it is that giant tuple containing
> state information.
>
> Doing a connect() seems to give me a pid in the sslsocket:
>
> ssl:connect("imap.gmail.com", 993, [{certfile, "cert.pem"}]).
> {ok,{sslsocket,new_ssl,<0.56.0>}}
>
> Yet, in the documentation, both listen() and connect() return type
> sslsocket() which is a what controlling_process is documented as taking
> as the first argument?
>
> Maybe a new clause of controlling process that looks like this:
>
> controlling_process(#sslsocket{pid = {ListenSocket, Config}}, NewOwner) ->
>     #config{cb={CbModule, _, _, _}} = Config,
>     CbModule:controlling_process(ListenSocket, NewOwner).
>
> Seems like that'd let you change the controlling process for 'listen
> sockets' as well, assuming the caller is the current owner?
>
> Andrew
>
> _______________________________________________
> erlang-bugs mailing list
> erlang-bugs@REDACTED
> http://erlang.org/mailman/listinfo/erlang-bugs
>
>   




More information about the erlang-bugs mailing list