Handle case where connection meta-data are faulty
This commit is contained in:
parent
570f31ab3c
commit
1e60f35dd3
@ -1,6 +1,6 @@
|
||||
{application,gmhive_client,
|
||||
[{description,"Gajumaru Hive Client"},
|
||||
{vsn,"0.8.1"},
|
||||
{vsn,"0.8.2"},
|
||||
{registered,[]},
|
||||
{applications,[kernel,stdlib,sasl,gproc,inets,ssl,enoise,
|
||||
gmconfig,gmhive_protocol,gmhive_worker]},
|
||||
|
||||
@ -452,7 +452,20 @@ protocol_connect(Opts, #st{econn = EConn} = S) ->
|
||||
, nonces => gmhc_server:total_nonces()
|
||||
, signature => ""},
|
||||
?LOG_DEBUG("ConnectReq = ~p", [ConnectReq]),
|
||||
Msg = gmhp_msgs:encode_connect(ConnectReq, RId),
|
||||
try gmhp_msgs:encode_connect(ConnectReq, RId) of
|
||||
Msg ->
|
||||
send_connect(EConn, RId, Msg, ConnectReq, Opts, S)
|
||||
catch error:Error ->
|
||||
ErrMsg = unicode:characters_to_binary(io_lib:fwrite("~p", [Error])),
|
||||
disconnected(S#st.id, #{error =>
|
||||
#{code => gmhp_msgs:error_code(invalid_input),
|
||||
message => ErrMsg}}, S)
|
||||
end.
|
||||
|
||||
send_connect(EConn, RId, Msg, #{pubkey := Pubkey,
|
||||
extra_pubkeys := Extra,
|
||||
pool_id := PoolId,
|
||||
type := Type}, Opts, S) ->
|
||||
enoise:send(EConn, Msg),
|
||||
receive
|
||||
{noise, EConn, Data} ->
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
{type,app}.
|
||||
{modules,[]}.
|
||||
{prefix,"gmhc"}.
|
||||
{desc,"Gajumaru Hive Client"}.
|
||||
{author,"Ulf Wiger, QPQ AG"}.
|
||||
{package_id,{"uwiger","gmhive_client",{0,8,1}}}.
|
||||
{desc,"Gajumaru Hive Client"}.
|
||||
{package_id,{"uwiger","gmhive_client",{0,8,2}}}.
|
||||
{deps,[{"uwiger","gmhive_protocol",{0,2,0}},
|
||||
{"uwiger","gmhive_worker",{0,5,1}},
|
||||
{"uwiger","gmcuckoo",{1,2,4}},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user