- I started planning the megaphone module.
- I did some more planning for the megaphone module.
- I created the main loop for the megaphone module.
recv(ConnectionID) ->
megaphone ! { get_data, self(), ConnectionID },
receive
{ ok, Result } ->
{ ok, Result };
{ error, Reason } ->
{ error, Reason };
{ shutdown } ->
{ error, shutdown }
end.
The function to allow clients to send data does not have to worry about blocking and is much simpler:
send(ConnectionID, Data) ->
megaphone ! { send_data, ConnectionID, Data }.
The function that megaphon_receiver uses to hand data off to ejabberd is also simple:
receive_packet(ConnectionID, Data) ->
megaphone_sender ! {send, ConnectionID, Data}.
So much for the interface methods, next time I will go into the implementation of the main_loop methods.
No comments:
Post a Comment