diff options
author | Matthew Sackman <matthew@lshift.net> | 2009-07-09 15:01:14 +0100 |
---|---|---|
committer | Matthew Sackman <matthew@lshift.net> | 2009-07-09 15:01:14 +0100 |
commit | 75033954bd1b52efda757f6129a10cc878a3aa9a (patch) | |
tree | 723757d0b10ad0c6c8ca9b9ad2ded3ccc508638b | |
parent | de41d555872b0c30ce6a358ad659bc9b2d1a57a2 (diff) | |
download | rabbitmq-server-75033954bd1b52efda757f6129a10cc878a3aa9a.tar.gz |
*idiot*.
-rw-r--r-- | src/gen_server2.erl | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/gen_server2.erl b/src/gen_server2.erl index ba42c18f..e46f2645 100644 --- a/src/gen_server2.erl +++ b/src/gen_server2.erl @@ -335,12 +335,8 @@ enter_loop(Mod, Options, State, ServerName, Timeout) -> Parent = get_parent(), Debug = debug_options(Name, Options), Queue = priority_queue:new(), - TimeoutState = case Timeout of - {binary, Min} -> - {Min, Min, undefined}; - _ -> undefined - end, - loop(Parent, Name, State, Mod, Timeout, TimeoutState, Queue, Debug). + {Timeout1, TimeoutState} = build_timeout_state(Timeout), + loop(Parent, Name, State, Mod, Timeout1, TimeoutState, Queue, Debug). %%%======================================================================== %%% Gen-callback functions @@ -365,12 +361,9 @@ init_it(Starter, Parent, Name0, Mod, Args, Options) -> loop(Parent, Name, State, Mod, infinity, undefined, Queue, Debug); {ok, State, Timeout} -> proc_lib:init_ack(Starter, {ok, self()}), - TimeoutState = case Timeout of - {binary, Min} -> - {Min, Min, undefined}; - _ -> undefined - end, - loop(Parent, Name, State, Mod, binary, TimeoutState, Queue, Debug); + {Timeout1, TimeoutState} = build_timeout_state(Timeout), + loop(Parent, Name, State, Mod, Timeout1, TimeoutState, Queue, + Debug); {stop, Reason} -> %% For consistency, we must make sure that the %% registered name (if any) is unregistered before @@ -408,6 +401,12 @@ unregister_name({global,Name}) -> unregister_name(Pid) when is_pid(Pid) -> Pid. +build_timeout_state(Timeout) -> + case Timeout of + {binary, Min} -> {binary, {Min, Min, undefined}}; + _ -> {Timeout, undefined} + end. + %%%======================================================================== %%% Internal functions %%%======================================================================== |