Skip to content

Commit

Permalink
resolve hostname once per bot run
Browse files Browse the repository at this point in the history
  • Loading branch information
joelreymont committed Jul 16, 2009
1 parent 11c109a commit 8ed0af8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/bot.erl
Expand Up @@ -23,6 +23,8 @@

-export([run/6, test/1, test/2, test/4, publish/5]).

-include_lib("kernel/include/inet.hrl").

-record(state, {
bot,
barrier,
Expand All @@ -47,6 +49,7 @@
run(Bot, Host, Port, Message, Expected, N)
when is_tuple(Message),
is_integer(N) ->
{ok, #hostent{h_addr_list = [Addr | _]}} = inet:gethostbyname(Host),
{ok, Barrier} = barrier:start(counter, N),
State = #state{
bot = Bot,
Expand All @@ -57,7 +60,7 @@ run(Bot, Host, Port, Message, Expected, N)
min = 99999999,
max = 0,
avg = 0,
host = Host,
host = Addr,
port = Port,
message = Message,
expected = Expected,
Expand Down

0 comments on commit 8ed0af8

Please sign in to comment.