Merge branch 'jonte_rewrite' into rewrite
Conflicts: src/ggs_coordinator.erl src/ggs_dispatcher.erl src/ggs_player.erl
This commit is contained in:
commit
c63e243564
3 changed files with 11 additions and 2 deletions
|
@ -42,7 +42,11 @@ respawn_table(_Token) ->
|
||||||
|
|
||||||
%% @doc Removes a player from coordinator.
|
%% @doc Removes a player from coordinator.
|
||||||
remove_player(_From, _Player) ->
|
remove_player(_From, _Player) ->
|
||||||
|
<<<<<<< HEAD
|
||||||
helpers:not_implemented().
|
helpers:not_implemented().
|
||||||
|
=======
|
||||||
|
not_implemented.
|
||||||
|
>>>>>>> jonte_rewrite
|
||||||
|
|
||||||
%% gen_server callbacks
|
%% gen_server callbacks
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ start_link(Port) ->
|
||||||
%% Reason = String
|
%% Reason = String
|
||||||
stop(_Reason) -> helpers:not_implemented().
|
stop(_Reason) -> helpers:not_implemented().
|
||||||
|
|
||||||
|
|
||||||
%% gen_server callbacks
|
%% gen_server callbacks
|
||||||
|
|
||||||
%% @doc Initiate the dispatcher. This is called from gen_server
|
%% @doc Initiate the dispatcher. This is called from gen_server
|
||||||
|
|
|
@ -30,13 +30,17 @@ get_token(_Player) ->
|
||||||
%% @doc Properly terminates the player process. The player token will be destroyed.
|
%% @doc Properly terminates the player process. The player token will be destroyed.
|
||||||
%% Makes table token unreferenced and destroys the process in the end.
|
%% Makes table token unreferenced and destroys the process in the end.
|
||||||
%% @spec stop(Table::pid()) -> Reason::string()
|
%% @spec stop(Table::pid()) -> Reason::string()
|
||||||
stop(Table) ->
|
stop(_Table) ->
|
||||||
helpers:not_implemented().
|
helpers:not_implemented().
|
||||||
|
|
||||||
|
|
||||||
%% Internals
|
%% Internals
|
||||||
|
|
||||||
loop(Socket) ->
|
loop(Socket) ->
|
||||||
|
% The socket is in 'active' mode, and that means we are pushed any data
|
||||||
|
% that arrives on it, we do not need to recv() manually. Since the socket
|
||||||
|
% was opened in our parent process, we need to change the owner of it to
|
||||||
|
% us, otherwise these messages end up in our parent.
|
||||||
|
erlang:port_connect(Socket, self()),
|
||||||
receive {tcp, Socket, Data} -> % Just echo for now..
|
receive {tcp, Socket, Data} -> % Just echo for now..
|
||||||
gen_tcp:send(Socket,Data),
|
gen_tcp:send(Socket,Data),
|
||||||
loop(Socket)
|
loop(Socket)
|
||||||
|
|
Reference in a new issue