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