From 0282694a287ac0a9b4dfe288fb258af2ea215ca8 Mon Sep 17 00:00:00 2001 From: Denis Knauf Date: Wed, 28 Sep 2022 11:06:53 +0200 Subject: [PATCH] Knot::Protocol: Fix iteration. --- lib/knot/protocol.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/knot/protocol.rb b/lib/knot/protocol.rb index 0fda3b3..3ba7b2b 100644 --- a/lib/knot/protocol.rb +++ b/lib/knot/protocol.rb @@ -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