Knot::Protocol: Fix iteration.

This commit is contained in:
Denis Knauf 2022-09-28 11:06:53 +02:00
parent 88e38eab7a
commit 0282694a28

View file

@ -164,9 +164,9 @@ class Knot::Protocol
sock = StringIO.new s sock = StringIO.new s
sock.write [1].pack( 'c') sock.write [1].pack( 'c')
data[:flags] ||= '' data[:flags] ||= ''
Idx::Idx.each_with_index do |n, i| Idx::Idx.each do |n|
v = data[n]&.to_s v = data[n.to_sym]&.to_s&.b
sock.write [0x10+i, v.size, v].pack( 'c na*') if v sock.write [n.to_i, v.size, v].pack( 'c na*') if v
end end
sock.write [3].pack( 'c') sock.write [3].pack( 'c')
sock.flush sock.flush