Skip to content

Commit

Permalink
Cache remote listSources
Browse files Browse the repository at this point in the history
  • Loading branch information
ElvishJerricco committed Apr 2, 2015
1 parent c828d64 commit 692c221
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mod/WorkerServer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ return @class:require("RednetServer.lua")
return unpack(ret)
end

local oldCall = p.call
function p.call(name, method, ...)
if method == "listSources" then
cache[client].call = cache[client].call or {}
if not cache[client].call.listSources then
cache[client].call.listSources = {oldCall(name, method, ...)}
end
return unpack(cache[client].call.listSources)
end
return oldCall(name, method, ...)
end

pu.addPeripheralHandler(p, client.uid)

return client
Expand Down

0 comments on commit 692c221

Please sign in to comment.