Client can send request without indicating a server

This commit is contained in:
Karchnu 2020-07-14 14:13:46 +02:00
parent a5c6ebbc89
commit 1326bcf8e5

View File

@ -169,12 +169,6 @@ class AuthD::Response
end
end
class IPC::Context
def send(fd, response : AuthD::Response)
send fd, response.type.to_u8, response.to_json
end
end
class AuthD::Request
include JSON::Serializable
@ -370,8 +364,14 @@ class AuthD::Request
end
class IPC::Context
def send(fd, request : AuthD::Request)
send fd, request.type.to_u8, request.to_json
def send(fd, response : AuthD::Response)
send fd, response.type.to_u8, response.to_json
end
end
class IPC::Client
def send(request : AuthD::Request)
send @server_fd, request.type.to_u8, request.to_json
end
end
@ -574,15 +574,3 @@ module AuthD
send Request::SearchUser.new user_login
response = Response.from_ipc read
case response
when Response::MatchingUsers
response.users
when Response::Error
raise Exception.new response.reason
else
Exception.new
end
end
end
end