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 +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/protocol/zmtp/connection.rb +29 -0
- data/lib/protocol/zmtp/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: 7e34b96f57fcd6ff589b2d6431e222c40add5d7060aa9d4558027d8920600aa3
|
|
4
|
+
data.tar.gz: 50e83973b9f7044894fd67b487c23fe8b198d1bd03f1eab9a14833e950bc1ac9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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?
|