knot-ruby 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/knot/protocol.rb +3 -11
- data/lib/knot/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7dcc321520bfdad7567809f0e0a831205c27c32274cc28f34418216b8ccb7943
|
4
|
+
data.tar.gz: 8ddc6e7390566d2e310f1f97600d10f290957c51b8310d5575d92849be43b9f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fd70face0a5d90c2bd95e7fbb950de2351f6d5877e571435602705ad61dff6fa00a91b593a899e7a956e783d42ff0b29f7321eba60ac05034d9e64ae36717e6
|
7
|
+
data.tar.gz: a78d11ca483eeb906b04901f71e2d6468d7066fc31c72b88e7c66d4707e24eacc9ae5a22cfeaa9fb35fa6ef3495606fe520c53eaab1e3043b3d8907352970155
|
data/lib/knot/protocol.rb
CHANGED
@@ -183,21 +183,13 @@ class Knot::Protocol
|
|
183
183
|
|
184
184
|
def snd sock: nil, **data
|
185
185
|
rsock = sock || @sock
|
186
|
-
|
187
|
-
#sock = StringIO.new s
|
188
|
-
#sock.write [1].pack( 'c')
|
186
|
+
data = Hash[ *data.map {|k,v| [k.to_sym, v]}.flatten]
|
189
187
|
data[:flags] ||= ''
|
190
188
|
ds =
|
191
189
|
Idx.
|
192
|
-
select {|n| data[n.to_sym] }.
|
193
|
-
map {|n| v = data[n.to_sym].to_s.b; [n.to_i, v.size, v
|
190
|
+
select {|n| p [n.to_sym, data[n.to_sym]]; data[n.to_sym] }.
|
191
|
+
map {|n| v = data[n.to_sym].to_s.b; [n.to_i, v.size, v] }
|
194
192
|
s = [Types[:data].to_i, ds, Types[:block].to_i].flatten.pack( "c #{'c na*'*ds.length} c").b
|
195
|
-
#Idx.each do |n|
|
196
|
-
# v = data[n.to_sym]&.to_s&.b
|
197
|
-
# sock.write [n.to_i, v.size, v].pack( 'c na*') if v
|
198
|
-
#end
|
199
|
-
#sock.write [3].pack( 'c')
|
200
|
-
#sock.flush
|
201
193
|
if 0 >= @logger.sev_threshold
|
202
194
|
@logger.debug "send data #{data.inspect}"
|
203
195
|
@logger.debug "send raw #{s.inspect}"
|
data/lib/knot/version.rb
CHANGED