digital-transport 0.8.5 → 0.8.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/digital/transport/adapters/tcp.rb +6 -7
- data/lib/digital/transport/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63ca928d2d61df4e843e904e37bf8a54407e9726
|
4
|
+
data.tar.gz: 5af1b6bb79e5ecde94ecafd27e79d9dfe5822111
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41e222b45c2a0e39b475813e87491fe13c5a2e0e1c5606a8f87a9779a374d90c22cf1a2359154a1da8cfe02cdb676b7990edbc102168313fe4756bfe17f71d58
|
7
|
+
data.tar.gz: 0b6c047a8dcc7c7db68b3816a89d51d11a784ef10b870166eb6e1814b9f97620e7146ff440805fe4628f020e9eed1dca3275b981bdeedae8c84590aa797a8bdb
|
@@ -7,16 +7,15 @@ module Digital
|
|
7
7
|
module Adapters
|
8
8
|
class Tcp
|
9
9
|
include Functional
|
10
|
-
include Socket::Constants
|
11
10
|
include Digital::Transport::Errors
|
12
11
|
include Digital::Transport::Adapters::Interface
|
13
12
|
|
14
|
-
DEFAULTS = { timeout: 10,
|
13
|
+
DEFAULTS = { timeout: 10, tcp_nodelay: 1 }.freeze
|
15
14
|
|
16
15
|
def initialize(ip, port, opts = {})
|
17
|
-
@ip = ip
|
16
|
+
@ip = FinalVar.new(ip)
|
18
17
|
@opts = DEFAULTS.merge(opts.dup).freeze
|
19
|
-
@port = port
|
18
|
+
@port = FinalVar.new(port)
|
20
19
|
@io = nil
|
21
20
|
end
|
22
21
|
|
@@ -28,11 +27,11 @@ module Digital
|
|
28
27
|
#
|
29
28
|
def connect
|
30
29
|
return open? if open?
|
31
|
-
Socket.new(AF_INET, SOCK_STREAM, 0).tap do |socket|
|
32
|
-
socket.setsockopt(IPPROTO_TCP, TCP_NODELAY,
|
30
|
+
Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0).tap do |socket|
|
31
|
+
socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, @opts[:tcp_nodelay].to_i)
|
33
32
|
return connect_nonblock(
|
34
33
|
socket,
|
35
|
-
Socket.pack_sockaddr_in(@port, @ip),
|
34
|
+
Socket.pack_sockaddr_in(@port.value, @ip.value),
|
36
35
|
@opts[:timeout].to_i.nonzero? || DEFAULTS[:timeout]
|
37
36
|
)
|
38
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: digital-transport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roman Lishtaba
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|