net-protocol 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/net/protocol.rb +6 -15
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca28f0356ecc7ee77cb5d0ead1ea91d9a70446e9de9a8e4927bdd4caf8d8e910
4
- data.tar.gz: 394be407dd3ab468f376be2032a2c6c6d78d05863bd21a9353e206ea473bbc37
3
+ metadata.gz: dddd9155f88e3e664a77ae33aed748ce833c114871dfab60e2be632214a2e063
4
+ data.tar.gz: 45ea621c80a7cef086d1094502c47aa60c0320ab585a8dd0e9c4684de2be5608
5
5
  SHA512:
6
- metadata.gz: 52dcdc5b3c200e3f29dea711c392d6127e39cf5cdf12787bb585a41ca874ccb3b93c734145d688c4c83acf98f28f0c7e89ebc49aeeb64caa0cb172a452f9c73c
7
- data.tar.gz: d57a73c0d8a1260012f26826ef257b4b6df616aa07e0fd46fc63710b2cd5cf3dafd322db057db1202ae1158c77d729c9e65ec3e12cc2d1705a4a2d2221cf0962
6
+ metadata.gz: fa55cb8a2eb4d6a14815dc9367c5787aea13ce9f6127298aa41614ffdf1ac4b421a4d6e6da2ad40740c99ec6a18b7541fd9e194f2bfd3e093e1223683fa8e34d
7
+ data.tar.gz: e77247d5a85f3adcf618f47b8cf3ef9b0be28f6b988ae48de43c17796d9d6c2bff6fdb083784c636f6a122c4bfaddde722fefa28f46837bc4f8358f2a63c41f2
data/lib/net/protocol.rb CHANGED
@@ -26,7 +26,7 @@ require 'io/wait'
26
26
  module Net # :nodoc:
27
27
 
28
28
  class Protocol #:nodoc: internal use only
29
- VERSION = "0.2.0"
29
+ VERSION = "0.2.1"
30
30
 
31
31
  private
32
32
  def Protocol.protocol_param(name, val)
@@ -120,6 +120,7 @@ module Net # :nodoc:
120
120
  @continue_timeout = continue_timeout
121
121
  @debug_output = debug_output
122
122
  @rbuf = ''.b
123
+ @rbuf_empty = true
123
124
  @rbuf_offset = 0
124
125
  end
125
126
 
@@ -156,7 +157,7 @@ module Net # :nodoc:
156
157
  read_bytes = 0
157
158
  begin
158
159
  while read_bytes + rbuf_size < len
159
- if s = rbuf_consume_all_shareable!
160
+ if s = rbuf_consume_all
160
161
  read_bytes += s.bytesize
161
162
  dest << s
162
163
  end
@@ -177,7 +178,7 @@ module Net # :nodoc:
177
178
  read_bytes = 0
178
179
  begin
179
180
  while true
180
- if s = rbuf_consume_all_shareable!
181
+ if s = rbuf_consume_all
181
182
  read_bytes += s.bytesize
182
183
  dest << s
183
184
  end
@@ -249,18 +250,8 @@ module Net # :nodoc:
249
250
  @rbuf.bytesize - @rbuf_offset
250
251
  end
251
252
 
252
- # Warning: this method may share the buffer to avoid
253
- # copying. The caller must no longer use the returned
254
- # string once rbuf_fill has been called again
255
- def rbuf_consume_all_shareable!
256
- @rbuf_empty = true
257
- buf = if @rbuf_offset == 0
258
- @rbuf
259
- else
260
- @rbuf.byteslice(@rbuf_offset..-1)
261
- end
262
- @rbuf_offset = @rbuf.bytesize
263
- buf
253
+ def rbuf_consume_all
254
+ rbuf_consume if rbuf_size > 0
264
255
  end
265
256
 
266
257
  def rbuf_consume(len = nil)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-protocol
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yukihiro Matsumoto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-05 00:00:00.000000000 Z
11
+ date: 2022-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: timeout