<div dir="ltr"><div><div class="gmail_signature"><div dir="ltr"><div style="text-align:right"><br></div><div style="font-size:14px">Hi mail list:</div><div style="font-size:14px"><br><div>I started two nodes in my pc:<br></div><div><br></div><div>    erl -name '<a href="mailto:a@127.0.0.1" target="_blank">a@127.0.0.1</a>' -setcookie aa</div><div>    erl -name '<a href="mailto:b@127.0.0.1" target="_blank">b@127.0.0.1</a>' -setcookie bb<br></div><div><br></div><div>If I run erlang:set_cookie('<a href="mailto:b@127.0.0.1" target="_blank">b@127.0.0.1</a>', bb) in node a, a and b is connectable with each other.</div><div><br></div><div>But if i run both erlang:set_cookie('<a href="mailto:b@127.0.0.1" target="_blank">b@127.0.0.1</a>', bb) in node a and  erlang:set_cookie('<a href="mailto:a@127.0.0.1" target="_blank">a@127.0.0.1</a>', aa) in node b before i connect a and b, the connection will fail.</div><div><br></div><div><br></div><div>I found the code in dist_util.erl:</div><div><br></div><div><div>%%</div><div>%% Get the cookies for a node from auth</div><div>%%    </div><div>get_cookies(Node) -></div><div>    case auth:get_cookie(Node) of</div><div><span style="white-space:pre-wrap">     </span>X when is_atom(X) -></div><div><span style="white-space:pre-wrap">  </span>    {X,X}</div><div>%<span style="white-space:pre-wrap">    </span>{Y,Z} when is_atom(Y), is_atom(Z) -></div><div>%<span style="white-space:pre-wrap"> </span>    {Y,Z};</div><div>%<span style="white-space:pre-wrap">   </span>_ -></div><div>%<span style="white-space:pre-wrap"> </span>    erlang:error("Corrupt cookie database")</div><div>    end.    </div></div><div><br></div><div>This function should return {MyCookie,HisCookie} as the other code written in this module, but currently it just simply make MyCookie and HisCookie the same one. </div><div><br></div><div>I guess this design is for the convenience when you connecting a node having different cookie. In general you are not able to run erlang:set_cookie/2 before you connect it, you can only change your own cookie to connect other node.</div><div><br></div><div>But I think connection should also success if cookie is set by erlang:set_cookie/2 in both side for each other.</div><div><br></div><div>Do you think so?</div><div><br></div><div><div>------                                  </div><div class="" style="margin:2px 0px 0px"><div id=":18t" class="" tabindex="0"><img class="" src="https://ssl.gstatic.com/ui/v1/icons/mail/images/cleardot.gif"></div></div><span class=""><font color="#888888">Liu Zhongzheng</font></span></div></div></div></div></div>
</div>