wip
This commit is contained in:
parent
996e2e29b2
commit
58aafaf692
16
zx
16
zx
@ -1011,13 +1011,13 @@ submit(PackageFile) ->
|
|||||||
{ok, PackageData} = file:read_file(PackageFile),
|
{ok, PackageData} = file:read_file(PackageFile),
|
||||||
{"zomp.meta", MetaBin} = lists:keyfind("zomp.meta", 1, Files),
|
{"zomp.meta", MetaBin} = lists:keyfind("zomp.meta", 1, Files),
|
||||||
Meta = binary_to_term(MetaBin),
|
Meta = binary_to_term(MetaBin),
|
||||||
{package_id, {Realm, Package, Version}} = lists:keyfind(package_id, 1, Meta),
|
{Realm, Package, Version} = maps:get(package_id, Meta),
|
||||||
{ok, Socket} = connect_auth(Realm),
|
{ok, Socket} = connect_auth(Realm),
|
||||||
ok = send(Socket, {submit, {Realm, Package, Version}}),
|
ok = send(Socket, {submit, {Realm, Package, Version}}),
|
||||||
ok =
|
ok =
|
||||||
receive
|
receive
|
||||||
{tcp, Socket, Response1} ->
|
{tcp, Socket, RB1} ->
|
||||||
case binary_to_term(Response1) of
|
case binary_to_term(RB1) of
|
||||||
ready ->
|
ready ->
|
||||||
ok;
|
ok;
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
@ -1030,12 +1030,13 @@ submit(PackageFile) ->
|
|||||||
ok = log(warning, "Server timed out!"),
|
ok = log(warning, "Server timed out!"),
|
||||||
halt(0)
|
halt(0)
|
||||||
end,
|
end,
|
||||||
ok = send(Socket, PackageData),
|
ok = gen_tcp:send(Socket, PackageData),
|
||||||
ok = log(info, "Done sending contents of ~tp", [PackageFile]),
|
ok = log(info, "Done sending contents of ~tp", [PackageFile]),
|
||||||
ok =
|
ok =
|
||||||
receive
|
receive
|
||||||
{tcp, Socket, Response2} ->
|
{tcp, Socket, RB2} ->
|
||||||
log(info, "Response: ~tp", [Response2]);
|
Outcome = binary_to_term(RB2),
|
||||||
|
log(info, "Response: ~tp", [Outcome]);
|
||||||
{tcp_closed, Socket} ->
|
{tcp_closed, Socket} ->
|
||||||
halt_on_unexpected_close()
|
halt_on_unexpected_close()
|
||||||
after 5000 ->
|
after 5000 ->
|
||||||
@ -1302,8 +1303,9 @@ confirm_auth(Socket) ->
|
|||||||
%% connect_auth/4.
|
%% connect_auth/4.
|
||||||
|
|
||||||
prep_auth(Realm, RealmConf) ->
|
prep_auth(Realm, RealmConf) ->
|
||||||
|
UsersFile = filename:join(zomp_dir(), "zomp.users"),
|
||||||
Users =
|
Users =
|
||||||
case file:consult("zomp.users") of
|
case file:consult(UsersFile) of
|
||||||
{ok, U} ->
|
{ok, U} ->
|
||||||
U;
|
U;
|
||||||
{error, enoent} ->
|
{error, enoent} ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user