Skip to content
Snippets Groups Projects
Commit 22dafb72 authored by DarkGod's avatar DarkGod
Browse files

Speedup server connection on boot by ignoring empty commands

parent a41f55e9
No related branches found
No related tags found
No related merge requests found
......@@ -472,7 +472,7 @@ function _M:loadAddons(mod, saveuse)
hash_valid, hash_err = false, "cheat mode skipping addon validation"
else
local fmd5 = self:addonMD5(add)
hashlist[#hashlist+1] = {addon=add.version_name, md5=fmd5}
hashlist[#hashlist+1] = {module=mod.short_name, addon=add.version_name, md5=fmd5}
-- hash_valid, hash_err = profile:checkAddonHash(mod.short_name, add.version_name, fmd5)
end
......@@ -751,8 +751,8 @@ function _M:instanciate(mod, name, new_game, no_reboot)
local hashlist = self:loadAddons(mod, (save_desc and save_desc.addons) or (__module_extra_info.set_addons))
-- Check all hashes at once
hashlist[#hashlist+1] = {module=true, md5=module_md5}
hash_valid, hash_err = profile:checkBatchHash(mod.version_name, hashlist)
hashlist[#hashlist+1] = {module=mod.version_name, md5=module_md5}
hash_valid, hash_err = profile:checkBatchHash(hashlist)
print("[MODULE] All hashes validation: ", hash_valid, hash_err)
-- Now that addons are loaded we can load UI definitions
......
......@@ -688,11 +688,11 @@ function _M:checkAddonHash(module, addon, md5)
return true
end
function _M:checkBatchHash(module, list)
function _M:checkBatchHash(list)
if not self.auth then return nil, "no online profile active" end
if config.settings.cheat then return nil, "cheat mode active" end
if game and game:isTainted() then return nil, "savefile tainted" end
core.profile.pushOrder(table.serialize{o="CheckBatchHash", data={module=module, list=list}})
core.profile.pushOrder(table.serialize{o="CheckBatchHash", data=list})
local ok = false
local error = nil
......
......@@ -334,10 +334,13 @@ function _M:orderSetConfigsBatch(o)
print("[PROFILE THREAD] flushing CSETs")
local data = zlib.compress(table.serialize(self.setConfigsBatching))
self:command("FSET", data:len())
if self:read("200") then self.sock:send(data) end
if #self.setConfigsBatching <= 0 then
print("[PROFILE THREAD] flushing CSETs ignored, empty dataset")
else
local data = zlib.compress(table.serialize(self.setConfigsBatching))
self:command("FSET", data:len())
if self:read("200") then self.sock:send(data) end
end
self.setConfigsBatching = nil
else
print("[PROFILE THREAD] batching CSETs")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment