Skip to content

Commit 47b326f

Browse files
committed
Fix http_client.erl example with active mode
Fix http_client.erl so that the connection is closed and the application can exit after sucessfully receiving the web page when used with `{active, true}`. Closes #1842 Signed-off-by: Winford <[email protected]>
1 parent b94dfea commit 47b326f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

examples/erlang/http_client.erl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ loop(Conn) ->
5252
ok;
5353
{ok, UpdatedConn, Responses} ->
5454
io:format("Got: ~p~n", [Responses]),
55-
loop(UpdatedConn);
55+
case maybe_terminate(Responses, UpdatedConn) of
56+
ok -> loop(UpdatedConn);
57+
closed -> ok
58+
end;
5659
unknown ->
5760
io:format("Unexpected message: ~p~n", [Message]),
5861
error

0 commit comments

Comments
 (0)