summaryrefslogtreecommitdiff
path: root/src/counter.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/counter.erl')
-rw-r--r--src/counter.erl10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/counter.erl b/src/counter.erl
index b46503e..4f4b3f1 100644
--- a/src/counter.erl
+++ b/src/counter.erl
@@ -16,8 +16,14 @@ start_link() ->
init(_Args) ->
{ok, 0}.
-handle_call(_Request, _From, State) ->
- {reply, ok, State}.
+handle_call(next, _From, N) when N >= ?MAXCOUNT ->
+ {reply, 0, 0};
+handle_call(next, _From, N) ->
+ {reply, N + 1, N + 1};
+handle_call(get, _From, N) ->
+ {reply, N, N};
+handle_call({set, N}, _From, _N) ->
+ {reply, N, N}.
handle_cast(_Msg, State) ->
{noreply, State}.