Knot::Protocol: Fix iteration.

master
Denis Knauf 2022-09-28 11:06:53 +02:00
parent 88e38eab7a
commit 0282694a28
1 changed files with 3 additions and 3 deletions

View File

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