uw-handle-empty-nonces #8
@ -1,6 +1,6 @@
|
|||||||
{application,gmhive_client,
|
{application,gmhive_client,
|
||||||
[{description,"Gajumaru Hive Client"},
|
[{description,"Gajumaru Hive Client"},
|
||||||
{vsn,"0.4.4"},
|
{vsn,"0.4.5"},
|
||||||
{registered,[]},
|
{registered,[]},
|
||||||
{applications,[kernel,stdlib,sasl,gproc,inets,ssl,enoise,
|
{applications,[kernel,stdlib,sasl,gproc,inets,ssl,enoise,
|
||||||
gmconfig,gmhive_protocol,gmhive_worker]},
|
gmconfig,gmhive_protocol,gmhive_worker]},
|
||||||
|
@ -107,13 +107,16 @@ handle_cast({from_pool, #{via := Connector,
|
|||||||
%% We could check whether we have already received the candidate ...
|
%% We could check whether we have already received the candidate ...
|
||||||
%% For now, stop all workers, restart with new candidate
|
%% For now, stop all workers, restart with new candidate
|
||||||
try
|
try
|
||||||
% Most of the time we don't want to stop the worker. If we do, though, then
|
%% Most of the time we don't want to stop the worker. If we do, though, then
|
||||||
% we need to do it more carefully than this, or memory usage will triple.
|
%% we need to do it more carefully than this, or memory usage will triple.
|
||||||
% Workers1 = stop_workers(Workers),
|
%% Workers1 = stop_workers(Workers),
|
||||||
{Workers2, Cand1} = assign_nonces(Workers, Cand),
|
%%
|
||||||
#st{candidate = Cand2} = S1 = maybe_request_nonces(S#st{candidate = Cand1}),
|
%% Nonces may be [], in which case we need to request new nonces first.
|
||||||
NewWorkers = [spawn_worker(W, Cand2) || W <- Workers2],
|
#st{candidate = Cand1} = S1 = maybe_request_nonces(S#st{candidate = Cand}),
|
||||||
{noreply, S1#st{workers = NewWorkers}}
|
{Workers2, Cand2} = assign_nonces(Workers, Cand1),
|
||||||
|
#st{candidate = Cand3} = S2 = maybe_request_nonces(S1#st{candidate = Cand2}),
|
||||||
|
|||||||
|
NewWorkers = [spawn_worker(W, Cand3) || W <- Workers2],
|
||||||
|
{noreply, S2#st{workers = NewWorkers}}
|
||||||
catch
|
catch
|
||||||
Cat:Err:St ->
|
Cat:Err:St ->
|
||||||
?LOG_ERROR("CAUGHT ~p:~p / ~p", [Cat, Err, St]),
|
?LOG_ERROR("CAUGHT ~p:~p / ~p", [Cat, Err, St]),
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
{type,app}.
|
{type,app}.
|
||||||
{modules,[]}.
|
{modules,[]}.
|
||||||
{prefix,"gmhc"}.
|
{prefix,"gmhc"}.
|
||||||
{desc,"Gajumaru Hive Client"}.
|
|
||||||
{author,"Ulf Wiger, QPQ AG"}.
|
{author,"Ulf Wiger, QPQ AG"}.
|
||||||
{package_id,{"uwiger","gmhive_client",{0,4,4}}}.
|
{desc,"Gajumaru Hive Client"}.
|
||||||
|
{package_id,{"uwiger","gmhive_client",{0,4,5}}}.
|
||||||
{deps,[{"uwiger","gmcuckoo",{1,2,3}},
|
{deps,[{"uwiger","gmcuckoo",{1,2,3}},
|
||||||
{"uwiger","gmhive_worker",{0,3,0}},
|
{"uwiger","gmhive_worker",{0,3,0}},
|
||||||
{"otpr","eblake2",{1,0,1}},
|
{"otpr","eblake2",{1,0,1}},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user
If assign_nonces took a single nonce from the list, will this second request immediately fire? I guess that is fine?