mirror of
https://github.com/cyberarm/w3d_hub_linux_launcher.git
synced 2026-05-06 09:28:18 +00:00
More work on Ractor communication. Need to have a proper think about how to keep it DRY and KISS :)
This commit is contained in:
@@ -6,6 +6,8 @@ module W3DHubLauncher
|
||||
@threads = []
|
||||
@requests = []
|
||||
|
||||
@settings = # Settings.new
|
||||
|
||||
# next available request_id to assign incoming requests
|
||||
@request_id = 0
|
||||
|
||||
@@ -35,6 +37,13 @@ module W3DHubLauncher
|
||||
response = Response.new(result.okay? ? Request::STATUS_COMPLETE : Request::STATUS_ERROR, query.request_id, result)
|
||||
Ractor.main.send(response)
|
||||
end
|
||||
when Request::LAUNCHER_UPDATE_SETTINGS
|
||||
result = CyberarmEngine::Result.new
|
||||
FileUtils.mkdir_p(W3DHubLauncher::CONFIG_PATH) # FAILABLE!
|
||||
File.write("#{W3DHubLauncher::CONFIG_PATH}/settings.json", query.data) # FAILABLE!
|
||||
result.data = query.data
|
||||
response = Response.new(result.okay? ? Request::STATUS_COMPLETE : Request::STATUS_ERROR, query.request_id, result)
|
||||
Ractor.main.send(response)
|
||||
else
|
||||
raise "UNKNOWN REQUEST"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user