digital-transport 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 507c30df6b4922032b78a429b53c45727de4a1e5
|
4
|
+
data.tar.gz: cf66ce9d410277c8f57872da99f767e9470e6a86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bb507f23f253040b712c8d953a47973cf9ffae9d774d2d5eea722703aacb33343a72abba95685d4b07b333532f027142bca9db96e7c6ba7851e3e6385eab918
|
7
|
+
data.tar.gz: 00c4a2913cc370de0c0b384bbe01009e82a22bd09435270ab6a4176740f46ced7d63cbe4be28b6d423d1e0fe0e6f06149e89d19d9fcdd40d9d2001f399a4d5e4
|
data/digital-transport.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ['Roman Lishtaba']
|
10
10
|
spec.email = ['roman@lishtaba.com']
|
11
11
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
12
|
+
spec.summary = 'interface between multiple transport adapters'
|
13
|
+
spec.description = 'Library intended to unify interface between multiple transport adapters'
|
14
14
|
spec.homepage = 'https://github.com/rlishtaba/ruby-digital-transport'
|
15
15
|
spec.license = 'MIT'
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|bin)/}) }
|
@@ -28,4 +28,4 @@ Gem::Specification.new do |spec|
|
|
28
28
|
|
29
29
|
spec.add_dependency 'functional-ruby'
|
30
30
|
spec.add_dependency 'rs_232', '~> 2.0', '>= 2.0.5' unless RUBY_PLATFORM === /java/
|
31
|
-
end
|
31
|
+
end
|
@@ -30,9 +30,10 @@ module Digital
|
|
30
30
|
Socket.new(AF_INET, SOCK_STREAM, 0).tap do |socket|
|
31
31
|
socket.setsockopt(IPPROTO_TCP, TCP_NODELAY, (@opts[:tcp_nodelay] || DEFAULTS[:tcp_no_delay]).to_i)
|
32
32
|
return connect_nonblock(
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
socket,
|
34
|
+
Socket.pack_sockaddr_in(@port, @ip),
|
35
|
+
@opts[:timeout].to_i.nonzero? || DEFAULTS[:timeout]
|
36
|
+
)
|
36
37
|
end
|
37
38
|
end
|
38
39
|
|
@@ -94,7 +95,9 @@ module Digital
|
|
94
95
|
|
95
96
|
# @api private
|
96
97
|
def connect_nonblock(io_like, endpoint, timeout)
|
97
|
-
|
98
|
+
# IO.connect_nonblock retrun value is different across multiple platform.
|
99
|
+
io_like.connect_nonblock(endpoint)
|
100
|
+
io_like
|
98
101
|
rescue Errno::EINPROGRESS # connection in progress, wait a bit.
|
99
102
|
IO.select(nil, [io_like], nil, timeout) ? retry : nil
|
100
103
|
rescue Errno::EISCONN # The socket is already connected.
|
@@ -106,4 +109,4 @@ module Digital
|
|
106
109
|
end
|
107
110
|
end
|
108
111
|
end
|
109
|
-
end
|
112
|
+
end
|