Skip to content

Commit

Permalink
core.packet: require explicit initialization of packets freelist
Browse files Browse the repository at this point in the history
This is to ensure that supervisors loading the core.packet module will not
populate their SHM roots.
  • Loading branch information
eugeneia committed Oct 29, 2018
1 parent ace9b32 commit c6b32f4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function initialize ()
_G.engine = require("core.app")
_G.memory = require("core.memory")
_G.link = require("core.link")
_G.packet = require("core.packet")
_G.packet = require("core.packet"); _G.packet.initialize()
_G.timer = require("core.timer")
_G.main = getfenv()
end
Expand Down
9 changes: 7 additions & 2 deletions src/core/packet.lua
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,13 @@ end

local packet_allocation_step = 1000
local packets_allocated = 0
local packets_fl = freelist_create("engine/packets.freelist")
local group_fl -- Initialized on demand.
-- Initialized on demand.
local packets_fl, group_fl

-- Call to ensure packet freelist is enabled.
function initialize ()
packets_fl = freelist_create("engine/packets.freelist")
end

-- Call to ensure group freelist is enabled.
function enable_group_freelist ()
Expand Down

0 comments on commit c6b32f4

Please sign in to comment.