Skip to content

Commit

Permalink
doc(server): handle_QUIT callback
Browse files Browse the repository at this point in the history
  • Loading branch information
sntran authored Feb 18, 2024
1 parent 895d8a4 commit 20d5f84
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/gen_nntp.ex
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,13 @@ defmodule GenNNTP do
"""
@callback handle_HELP(state) :: {:ok, help_text :: String.t(), state}

@doc """
Invoked when a client quits.
Returning `{:ok, new_state}` to close the connection.
"""
@callback handle_QUIT(state) :: {:ok, state}

@doc """
Invoked when an uknown command is asked by the client.
Expand Down Expand Up @@ -568,6 +575,7 @@ defmodule GenNNTP do
handle_BODY: 2,
handle_STAT: 2,
handle_POST: 2,
handle_QUIT: 1,
handle_command: 2
]
end
3 changes: 3 additions & 0 deletions src/gen_nntp.erl
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@

-callback handle_HELP(state()) -> {ok, HelpText :: binary(), state()}.

-callback handle_QUIT(state()) -> {ok, state()}.

-callback handle_command(Command :: binary(), state()) ->
{reply, Response :: binary(), state()}
| {noreply, state()}
Expand All @@ -155,6 +157,7 @@
handle_BODY/2,
handle_STAT/2,
handle_POST/2,
handle_QUIT/1,
handle_command/2
]).

Expand Down

0 comments on commit 20d5f84

Please sign in to comment.