diff options
author | Logan Hunt <logan.hunt@usu.edu> | 2023-01-31 12:44:15 -0700 |
---|---|---|
committer | Logan Hunt <logan.hunt@usu.edu> | 2023-01-31 12:44:15 -0700 |
commit | e5d97870a12ec87bd463b7657923bb79d3bcb4cc (patch) | |
tree | e552aa6d98d9ccf628d4274b8d9538e741724530 /lib/chessh/ssh/client/client.ex | |
parent | 4394d4721ccd5d9b503d01918ff3d6e5d6744c9d (diff) | |
download | chessh-e5d97870a12ec87bd463b7657923bb79d3bcb4cc.tar.gz chessh-e5d97870a12ec87bd463b7657923bb79d3bcb4cc.zip |
Rate limit game creation
Diffstat (limited to 'lib/chessh/ssh/client/client.ex')
-rw-r--r-- | lib/chessh/ssh/client/client.ex | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/chessh/ssh/client/client.ex b/lib/chessh/ssh/client/client.ex index 67aa920..461dfbe 100644 --- a/lib/chessh/ssh/client/client.ex +++ b/lib/chessh/ssh/client/client.ex @@ -45,17 +45,20 @@ defmodule Chessh.SSH.Client do screen_state_initials: screen_state_initials } = state ) do - {:ok, new_screen_pid} = - GenServer.start_link(module, [%{screen_state_initial | client_pid: self()}]) + case GenServer.start_link(module, [%{screen_state_initial | client_pid: self()}]) do + {:ok, new_screen_pid} -> + send(new_screen_pid, {:render, width, height}) - send(new_screen_pid, {:render, width, height}) + {:noreply, + %State{ + state + | screen_pid: new_screen_pid, + screen_state_initials: [{module, screen_state_initial} | screen_state_initials] + }} - {:noreply, - %State{ - state - | screen_pid: new_screen_pid, - screen_state_initials: [{module, screen_state_initial} | screen_state_initials] - }} + _ -> + {:noreply, state} + end end @impl true |