From 42425b02260d279cd9c12fb3e625282979b9e308 Mon Sep 17 00:00:00 2001 From: Simponic Date: Fri, 30 Dec 2022 05:46:35 -0700 Subject: Add scalable session thresholds --- lib/chessh/ssh/cli.ex | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 lib/chessh/ssh/cli.ex (limited to 'lib/chessh/ssh/cli.ex') diff --git a/lib/chessh/ssh/cli.ex b/lib/chessh/ssh/cli.ex new file mode 100644 index 0000000..7ab0433 --- /dev/null +++ b/lib/chessh/ssh/cli.ex @@ -0,0 +1,26 @@ +defmodule Chessh.SSH.Cli do + @behaviour :ssh_server_channel + + def init() do + {:ok, %{}} + end + + def handle_msg(message, state) do + {:ok, state} + end + + def handle_ssh_msg(message, state) do + {:ok, state} + end + + def handle_ssh_msg( + {:ssh_cm, _connection_handler, {:exit_signal, channel_id, signal, err, lang}}, + state + ) do + {:stop, channel_id, state} + end + + def terminate(reason, state) do + :ok + end +end -- cgit v1.3 From 9add1557b30c630cf45a1018cefc9a4a202db113 Mon Sep 17 00:00:00 2001 From: Simponic Date: Fri, 30 Dec 2022 05:49:40 -0700 Subject: Ignore unused cli vars --- lib/chessh/ssh/cli.ex | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/chessh/ssh/cli.ex') diff --git a/lib/chessh/ssh/cli.ex b/lib/chessh/ssh/cli.ex index 7ab0433..c7befe0 100644 --- a/lib/chessh/ssh/cli.ex +++ b/lib/chessh/ssh/cli.ex @@ -5,22 +5,22 @@ defmodule Chessh.SSH.Cli do {:ok, %{}} end - def handle_msg(message, state) do - {:ok, state} - end - - def handle_ssh_msg(message, state) do + def handle_msg(_message, state) do {:ok, state} end def handle_ssh_msg( - {:ssh_cm, _connection_handler, {:exit_signal, channel_id, signal, err, lang}}, + {:ssh_cm, _connection_handler, {:exit_signal, channel_id, _signal, _err, _lang}}, state ) do {:stop, channel_id, state} end - def terminate(reason, state) do + def handle_ssh_msg(_message, state) do + {:ok, state} + end + + def terminate(_reason, _state) do :ok end end -- cgit v1.3 From e7d8c61487815bd90ec5834dad5e6f64dd951b53 Mon Sep 17 00:00:00 2001 From: Simponic Date: Fri, 30 Dec 2022 05:51:47 -0700 Subject: More warning squashing --- lib/chessh/auth/password.ex | 1 - lib/chessh/ssh/cli.ex | 2 +- lib/chessh/ssh/daemon.ex | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/chessh/ssh/cli.ex') diff --git a/lib/chessh/auth/password.ex b/lib/chessh/auth/password.ex index a01291d..0986169 100644 --- a/lib/chessh/auth/password.ex +++ b/lib/chessh/auth/password.ex @@ -8,7 +8,6 @@ defmodule Chessh.Auth.PasswordAuthenticator do def authenticate(username, password) do case Repo.get_by(Player, username: username) do player -> authenticate(player, password) - nil -> false end end end diff --git a/lib/chessh/ssh/cli.ex b/lib/chessh/ssh/cli.ex index c7befe0..71d789b 100644 --- a/lib/chessh/ssh/cli.ex +++ b/lib/chessh/ssh/cli.ex @@ -1,7 +1,7 @@ defmodule Chessh.SSH.Cli do @behaviour :ssh_server_channel - def init() do + def init(_args) do {:ok, %{}} end diff --git a/lib/chessh/ssh/daemon.ex b/lib/chessh/ssh/daemon.ex index 9ffc538..b341833 100644 --- a/lib/chessh/ssh/daemon.ex +++ b/lib/chessh/ssh/daemon.ex @@ -1,5 +1,5 @@ defmodule Chessh.SSH.Daemon do - alias Chessh.{Repo, PlayerSession, Player, Utils} + alias Chessh.{Repo, PlayerSession, Utils} alias Chessh.Auth.PasswordAuthenticator use GenServer import Ecto.Query -- cgit v1.3