Fun with Erlang (was Re: Stand Alone Erlang for Windows. yet again)

Ulf Wiger etxuwig@REDACTED
Mon Mar 19 11:24:05 CET 2001


On Sat, 17 Mar 2001, Chris Pressey wrote:

>But, I considered the peer-to-peer model for multiplayer games, and
>I concluded hacked peers open up too much of a loophole for
>cheating, leading me to stick to a pretty strict client-server
>model.

I've been thinking part time about how to address such problems.

One way would be to hack net_kernel.erl, and rpc.erl, only allowing
message passing and rpc calls that you feel are kosher.

Hacking net_kernel.erl is no picnic, but here's a place to start:

%% 
%% The spawn/4 BIF ends up here.
%% 
handle_call({spawn,M,F,A,Gleader},{From,Tag},State) when pid(From)->
    Pid = (catch spawn(M,F,A)),
    group_leader(Gleader,Pid),
    {reply,Pid,State};

%% 
%% The spawn_link/4 BIF ends up here.
%% 
handle_call({spawn_link,M,F,A,Gleader}, {From,Tag}, State)
when pid(From) ->
    catch spawn(net_kernel,do_spawn_link,[{From,Tag},M,F,A,Gleader]),
    {noreply,State};

handle_info({From,registered_send,To,Mess},State) ->
    send(From,To,Mess),
    {noreply,State};


I spent some time trying to figure out from where these messages
came. It seems as if they come from dist.c directly.

The interesting thing is that sometimes, the emulator dispatches
messages directly, while they sometimes are routed via net_kernel.
My understanding is that they come up to net_kernel only when
the distributed handshake is not quite done.

Then, hacking net_kernel doesn't solve anything. A pity.

/Uffe
-- 
Ulf Wiger                                    tfn: +46  8 719 81 95
Senior System Architect                      mob: +46 70 519 81 95
Strategic Product & System Management    ATM Multiservice Networks
Data Backbone & Optical Services Division      Ericsson Telecom AB




More information about the erlang-questions mailing list