protocol-zmtp 0.11.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee205bfb130a7339b633a11d3dc7f6f04b4cc38eebafc296fc92ae1f8e01078e
4
- data.tar.gz: a71f3704bf7a5b9e95b605f96e3ed9ab9e96fc4d2ebc3f2117aad001b9d90b1d
3
+ metadata.gz: 7e34b96f57fcd6ff589b2d6431e222c40add5d7060aa9d4558027d8920600aa3
4
+ data.tar.gz: 50e83973b9f7044894fd67b487c23fe8b198d1bd03f1eab9a14833e950bc1ac9
5
5
  SHA512:
6
- metadata.gz: 72c2282908a49b0cc56e79b1503158910a153990dd8589c68c1bd2194eca56a9392c7103142e3c35a14be94da6aeff1e307d986fbca8c712426ea66713e2ff00
7
- data.tar.gz: 8ed3e02e97f0c039a970fca6b85a52596cf73e35699436e79f9adf7b7242f4bc4aaee187405b9e63ba926996cee23496f4599e05287725da988daa323798623c
6
+ metadata.gz: 21d691934fcf3ee53a68d40e43859ba593eb822f5d84d08125d43561aa8de40b8b6922c6cb0fbb06c640e3b078310018fc2ecd7c0fe9e415cbe5f94f8db210a6
7
+ data.tar.gz: 77930c852f0b2b8422a02c685bb7d0f24613d64533d7945f28e064503f83b8802f9e9f62215234d4eaa022df48911d793ccd30871a78ce17abc3773edf59da86
data/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## [0.11.1] - 2026-12-03
6
+
7
+ ### Added
8
+
9
+ - `Connection#linger_close(timeout)`: flushes and shuts down the write side,
10
+ reads and discards until the peer's EOF or the timeout, then closes.
11
+
5
12
  ## [0.11.0] - 2026-11-26
6
13
 
7
14
  ### Added
@@ -422,6 +422,35 @@ module Protocol
422
422
  end
423
423
 
424
424
 
425
+ # Closes once the peer has read everything we sent. Flushes and
426
+ # shuts down the write side, then reads and discards until the
427
+ # peer's EOF or +timeout+. Bytes the peer sends meanwhile, such as
428
+ # a PING, would otherwise make our kernel reset the connection and
429
+ # discard what it hasn't sent yet.
430
+ #
431
+ # @param timeout [Numeric] seconds to wait for the peer's EOF
432
+ # @return [void]
433
+ def linger_close(timeout)
434
+ return unless @io.respond_to?(:close_write)
435
+
436
+ raw = @io.respond_to?(:io) ? @io.io : @io
437
+ deadline = Process.clock_gettime(Process::CLOCK_MONOTONIC) + timeout
438
+
439
+ @io.close_write
440
+
441
+ loop do
442
+ remaining = deadline - Process.clock_gettime(Process::CLOCK_MONOTONIC)
443
+
444
+ break unless remaining.positive? && raw.wait_readable(remaining)
445
+ break if raw.read_nonblock(16_384, exception: false).nil?
446
+ end
447
+ rescue IOError, SystemCallError
448
+ # the peer reset the connection, or it is closed
449
+ ensure
450
+ close
451
+ end
452
+
453
+
425
454
  # @return [Boolean] whether a frame write is in progress
426
455
  def writing?
427
456
  @mutex.locked?
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Protocol
4
4
  module ZMTP
5
- VERSION = "0.11.0"
5
+ VERSION = "0.11.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protocol-zmtp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrik Wenger