ipc07
Karchnu 2020-07-14 14:17:06 +02:00
parent 1326bcf8e5
commit 867484aab4
1 changed files with 24 additions and 12 deletions

View File

@ -363,18 +363,6 @@ class AuthD::Request
end
end
class IPC::Context
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
module AuthD
class Client < IPC::Client
property key : String
@ -574,3 +562,27 @@ 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
class IPC::Context
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, }equest.type.to_u8, request.to_json
end
end