tcp-client 1.0.2 → 1.0.4
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/README.md +2 -2
- data/lib/tcp-client/address.rb +24 -31
- data/lib/tcp-client/configuration.rb +4 -4
- data/lib/tcp-client/version.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3605cb7c8c4ae8e3da02040016d2dfb5ea74010693e802ffbb008b370a3dd3d0
|
|
4
|
+
data.tar.gz: 16eac136830f9cf8afc28c733e77d0de37510441b9e20d8673b484df188270cf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 76930c3206545a21c4e6276d78fa78215e48871f71c25c5c1b4661292a4236b309c1e58accb4206afff16a50aa5281cc5db6ba2ca372fc108bb64482d7a53906
|
|
7
|
+
data.tar.gz: f9db7319fa8988fd24ba6d456ece386e9a98431c119eef0ac3c4bba19bbe99c558147acdd3f2d457585e6b9ba447c89b704d16c6442750b23dd33179778f772b
|
data/README.md
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Use your TCP connections with working timeout.
|
|
4
4
|
|
|
5
5
|
- Gem: [rubygems.org](https://rubygems.org/gems/tcp-client)
|
|
6
|
-
- Source: [
|
|
7
|
-
- Help: [rubydoc.info](https://rubydoc.info/gems/tcp-client/
|
|
6
|
+
- Source: [codeberg.org](https://codeberg.org/mblumtritt/tcp-client)
|
|
7
|
+
- Help: [rubydoc.info](https://rubydoc.info/gems/tcp-client/index)
|
|
8
8
|
|
|
9
9
|
## Description
|
|
10
10
|
|
data/lib/tcp-client/address.rb
CHANGED
|
@@ -100,19 +100,24 @@ class TCPClient
|
|
|
100
100
|
# @return [Address] itself
|
|
101
101
|
#
|
|
102
102
|
def freeze
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
end
|
|
103
|
+
return if frozen?
|
|
104
|
+
solve
|
|
105
|
+
@addrinfo.freeze
|
|
106
|
+
@host.freeze
|
|
108
107
|
super
|
|
109
108
|
end
|
|
110
109
|
|
|
111
|
-
#
|
|
112
|
-
def ==(other)
|
|
110
|
+
# @private
|
|
111
|
+
def ==(other)
|
|
112
|
+
host == other.host && port == other.port
|
|
113
|
+
rescue NoMethodError
|
|
114
|
+
false
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# @private
|
|
113
118
|
alias eql? ==
|
|
114
119
|
|
|
115
|
-
#
|
|
120
|
+
# @private
|
|
116
121
|
def equal?(other) = self.class == other.class && self == other
|
|
117
122
|
|
|
118
123
|
private
|
|
@@ -120,34 +125,22 @@ class TCPClient
|
|
|
120
125
|
def solve
|
|
121
126
|
case @addr
|
|
122
127
|
when self.class
|
|
123
|
-
|
|
128
|
+
unless @addr.frozen?
|
|
129
|
+
@addr = @addr.instance_variable_get(:@addr)
|
|
130
|
+
return solve
|
|
131
|
+
end
|
|
132
|
+
@addrinfo = @addr.addrinfo
|
|
133
|
+
@host = @addr.host
|
|
124
134
|
when Addrinfo
|
|
125
|
-
|
|
135
|
+
@addrinfo = @addr
|
|
126
136
|
when Integer
|
|
127
|
-
|
|
137
|
+
@addrinfo = Addrinfo.tcp(nil, @addr)
|
|
128
138
|
else
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
@addr = nil
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
def from_self_class(address)
|
|
135
|
-
unless address.frozen?
|
|
136
|
-
@addr = address.instance_variable_get(:@addr)
|
|
137
|
-
return solve
|
|
139
|
+
@host, port = host_n_port(@addr.to_s)
|
|
140
|
+
@addrinfo = Addrinfo.tcp(@host, port)
|
|
138
141
|
end
|
|
139
|
-
@addrinfo = address.addrinfo
|
|
140
|
-
@host = address.host
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
def from_addrinfo(addrinfo)
|
|
144
|
-
@host = (@addrinfo = addrinfo).getnameinfo(Socket::NI_NUMERICSERV).first
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
def from_string(str)
|
|
148
|
-
@host, port = host_n_port(str.to_s)
|
|
149
|
-
@addrinfo = Addrinfo.tcp(@host, port)
|
|
150
142
|
@host ||= @addrinfo.getnameinfo(Socket::NI_NUMERICSERV).first
|
|
143
|
+
@addr = nil
|
|
151
144
|
end
|
|
152
145
|
|
|
153
146
|
def host_n_port(str)
|
|
@@ -313,24 +313,24 @@ class TCPClient
|
|
|
313
313
|
self
|
|
314
314
|
end
|
|
315
315
|
|
|
316
|
-
#
|
|
316
|
+
# @private
|
|
317
317
|
def freeze
|
|
318
318
|
@ssl_params.freeze
|
|
319
319
|
super
|
|
320
320
|
end
|
|
321
321
|
|
|
322
|
-
#
|
|
322
|
+
# @private
|
|
323
323
|
def initialize_copy(_org)
|
|
324
324
|
super
|
|
325
325
|
@ssl_params = Hash[@ssl_params] if @ssl_params
|
|
326
326
|
self
|
|
327
327
|
end
|
|
328
328
|
|
|
329
|
-
#
|
|
329
|
+
# @private
|
|
330
330
|
def ==(other) = to_hash == other.to_h
|
|
331
331
|
alias eql? ==
|
|
332
332
|
|
|
333
|
-
#
|
|
333
|
+
# @private
|
|
334
334
|
def equal?(other) = self.class == other.class && to_hash == other.to_hash
|
|
335
335
|
|
|
336
336
|
private
|
data/lib/tcp-client/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tcp-client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mike Blumtritt
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies: []
|
|
12
12
|
description: |
|
|
13
13
|
This gem implements a customizable TCP client class that gives you control
|
|
@@ -17,8 +17,8 @@ description: |
|
|
|
17
17
|
executables: []
|
|
18
18
|
extensions: []
|
|
19
19
|
extra_rdoc_files:
|
|
20
|
-
- README.md
|
|
21
20
|
- LICENSE
|
|
21
|
+
- README.md
|
|
22
22
|
files:
|
|
23
23
|
- ".yardopts"
|
|
24
24
|
- LICENSE
|
|
@@ -34,14 +34,15 @@ files:
|
|
|
34
34
|
- lib/tcp-client/version.rb
|
|
35
35
|
- lib/tcp-client/with_deadline.rb
|
|
36
36
|
- lib/tcp_client.rb
|
|
37
|
-
homepage: https://
|
|
37
|
+
homepage: https://codeberg.org/mblumtritt/tcp-client
|
|
38
38
|
licenses:
|
|
39
39
|
- BSD-3-Clause
|
|
40
40
|
metadata:
|
|
41
|
-
source_code_uri: https://
|
|
42
|
-
bug_tracker_uri: https://
|
|
41
|
+
source_code_uri: https://codeberg.org/mblumtritt/tcp-client
|
|
42
|
+
bug_tracker_uri: https://codeberg.org/mblumtritt/tcp-client/issues
|
|
43
43
|
documentation_uri: https://rubydoc.info/gems/tcp-client
|
|
44
44
|
rubygems_mfa_required: 'true'
|
|
45
|
+
yard.run: yard
|
|
45
46
|
rdoc_options: []
|
|
46
47
|
require_paths:
|
|
47
48
|
- lib
|
|
@@ -56,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
56
57
|
- !ruby/object:Gem::Version
|
|
57
58
|
version: '0'
|
|
58
59
|
requirements: []
|
|
59
|
-
rubygems_version: 3.
|
|
60
|
+
rubygems_version: 3.7.2
|
|
60
61
|
specification_version: 4
|
|
61
62
|
summary: Use your TCP connections with working timeout.
|
|
62
63
|
test_files: []
|