Implement protocol encryption #2

Merged
kodi merged 6 commits from encryption into main 2024-10-05 12:07:04 +02:00
Showing only changes of commit 93f8432bd1 - Show all commits

View File

@ -48,9 +48,6 @@ defmodule Amethyst.ConnectionHandler do
@spec loop(:gen_tcp.socket(), atom(), integer(), map()) :: no_return() @spec loop(:gen_tcp.socket(), atom(), integer(), map()) :: no_return()
defp loop(socket, connstate, version, state) do defp loop(socket, connstate, version, state) do
receive do receive do
:closed ->
Logger.info("Connection #{inspect(socket)} closed.")
Process.exit(self(), :normal)
{:disconnect, reason} -> {:disconnect, reason} ->
disconnect(socket, reason, connstate, version, state) disconnect(socket, reason, connstate, version, state)
Process.exit(self(), :normal) Process.exit(self(), :normal)
@ -109,6 +106,9 @@ defmodule Amethyst.ConnectionHandler do
after 0 -> after 0 ->
# Received stuff from the connection receiver is lower priority # Received stuff from the connection receiver is lower priority
receive do receive do
:closed ->
Logger.info("Connection #{inspect(socket)} closed.")
Process.exit(self(), :normal)
{:get_encryption, from} -> {:get_encryption, from} ->
send(from, Map.get(state, :decryption_state)) send(from, Map.get(state, :decryption_state))
loop(socket, connstate, version, state) loop(socket, connstate, version, state)