knot-ruby 0.3.0 → 0.3.2
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 +2 -10
- 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: 30ab441e3adc29fe411bc05db071cbde34bdc5573d43bad9034e75826cd90aaa
|
4
|
+
data.tar.gz: fa5b3e725f3d6d28e64db6dd30787bb50a8004ad64d18d7b89317f5d00c2243b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36372dcb45977f8afc6e0b983d8182589fa684a40e1cce9f6045d590594f71199513e13e56aa8d51b66323e586418625d6c85d32875c583b23542a7fae0d4afd
|
7
|
+
data.tar.gz: e51f688d0931ce53b415c05f2cd531a8555ec7f0671d7e1b82b901a613a628670db45ab14886d21ef1fe48cf7157fe9942e9d4c3f5684f233cf100ded9eb4200
|
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
190
|
select {|n| data[n.to_sym] }.
|
193
|
-
map {|n| v = data[n.to_sym].to_s.b; [n.to_i, v.size, v
|
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