Z3LME4VKGE7Z5CXYOXH4YDZNHQPVCP7ORSMAQ2AQO7ZVQ5WASLHQC
6RQQDL46IO2ZFTJSEJREWJIMTNHOH4UBSO2VXAYNLEWNUR72OWHQC
spawn_link(fun() -> do_dial(ActualHost, Port, self()) end),
TransportPid = self(), spawn_link(fun() -> do_dial(ActualHost, Port, TransportPid) end),
TransportPid = self(),
spawn_link(fun() -> do_dial(ActualHost, Port, TransportPid) end),
spawn_link(fun() -> socket_loop(Socket, PeerAddr, self()) end),
TransportPid = self(), spawn_link(fun() -> socket_loop(Socket, PeerAddr, TransportPid) end),
spawn_link(fun() -> socket_loop(Socket, PeerAddr, TransportPid) end),
% Transfer socket ownership to the transport gen_server before we exit % Otherwise the socket will be closed when this process terminates ok = gen_tcp:controlling_process(Socket, TransportPid),
% Transfer socket ownership to the transport gen_server before we exit
% Otherwise the socket will be closed when this process terminates
ok = gen_tcp:controlling_process(Socket, TransportPid),
% Don't exit - keep running to maintain the socket connection socket_loop(Socket, PeerAddr, TransportPid),
% Don't exit - keep running to maintain the socket connection
socket_loop(Socket, PeerAddr, TransportPid),
% The transport gen_server will spawn socket_loop when it handles {new_connection, ...}