Skip to content

Commit

Permalink
fix(ARM) workaround for LuaJIT/ARM bug
Browse files Browse the repository at this point in the history
fixes #93
  • Loading branch information
Tieske committed May 18, 2020
1 parent 31aa1b1 commit 2118efc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ Release process:
4. commit and tag the release
5. upload rock to LuaRocks

### 5.0.x (unreleased)

- Fix: workaround for LuaJIT/ARM bug, see [Issue 93](https://github.com/Kong/lua-resty-dns-client/issues/93).


### 5.0.0 (14-May-2020)

- BREAKING: `getPeer` now returns the host-header value instead of the hostname
Expand All @@ -59,7 +64,7 @@ Release process:
ip-address as the hostname, but will now return `nil`. See
[PR 89](https://github.com/Kong/lua-resty-dns-client/pull/89).
- Added: option `useSRVname`, if truthy then `getPeer` will return the name as found
in the SRV record, instead of the hostname as added to the balancer.
in the SRV record, instead of the hostname as added to the balancer.
See [PR 89](https://github.com/Kong/lua-resty-dns-client/pull/89).
- Added: callback return an extra parameter; the host-header for the address added/removed.
- Fix: using the module instance instead of the passed one for dns resolution
Expand Down
8 changes: 8 additions & 0 deletions src/resty/dns/balancer/ring.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ function ring_address:addIndices(availableIndicesList, count)
return self
end


-- Drop an amount of indices and return them to the overall balancer.
-- @param availableIndicesList The list to add the dropped indices to
-- @param count (optional) The number of indices to drop, defaults to ALL if omitted
Expand Down Expand Up @@ -133,7 +134,14 @@ function ring_address:dropIndices(availableIndicesList, count)
-- table was reduced by at least half, so drop the original to reduce
-- memory footprint
self.indicesMax = size
--[[ next line disabled due to LuaJIT/ARM issue, see https://github.com/Kong/lua-resty-dns-client/issues/93
self.indices = table.move(self.indices, 1, size, 1, {})
Below a pure-Lua implementation --]]
local replacement = {}
for i = 1, size do
replacement[i] = self.indices[i]
end
self.indices = replacement
end
end
return availableIndicesList
Expand Down

0 comments on commit 2118efc

Please sign in to comment.