tcp-client 0.0.5 → 0.0.6

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
  SHA256:
3
- metadata.gz: 0bbd00fbb75a986e3ba4bf816193116bf727ec5dbbf7f8a668a9ceebb949d095
4
- data.tar.gz: f9ec77cfb580fe6d441f9cd34d50f62417406551ef4a5b2d88aa0abdc566c2ed
3
+ metadata.gz: 9a5a96328918c653aaec2296d19a7434b65c8801f3a1132a152dcd66326bc9ce
4
+ data.tar.gz: 5add4cd9d2607a90522b14c04a8b9d60a27bcad30c0f56212aba5df6c5036ac9
5
5
  SHA512:
6
- metadata.gz: 4ea1b91dd045ef05aab409a82161b2ec80d1e033744f036445c476f97b125bd5ac1ee4cf563ea27d5f26821a78995b274d1340ebf1ae2633da36867a3cfe26bd
7
- data.tar.gz: 16abbb3a36204bb56f8fc9d3193bbb9460da2cb2e11677a0ffe10a175ed862250ff19c740c71b81fc2c99724c71e9a419f9388c0a881c806ad6af1f9a8fa13d6
6
+ metadata.gz: 859acc902ed173236fac760ce2edbbda4353bf7fb438ecdb3856bdba3076a464a34f542458abc5b1fb2ec157b4f3ab007e0eb67123c551f1b6abedc6f810d978
7
+ data.tar.gz: 36b9c267842f00e2d6181d2523b84b776528b7d754fb4eb378fbdb4fc8d33fbb43ac7b9faf5ff613cf34c4687cc2eab74eaff04601fa72196efe3787d622dc7d
@@ -70,6 +70,11 @@ class TCPClient
70
70
  end
71
71
 
72
72
  def write(*msg, timeout: @write_timeout)
73
- closed? ? NotConnected.raise!(self) : @socket.write(*msg, timeout: timeout, exception: Timeout)
73
+ closed? ? NotConnected.raise!(self) : @socket.write(*msg, timeout: timeout, exception: Timeout)
74
+ end
75
+
76
+ def flush
77
+ @socket.flush unless closed?
78
+ self
74
79
  end
75
80
  end
@@ -21,7 +21,7 @@ class TCPClient
21
21
  def ssl=(yn)
22
22
  return @ssl_params = nil unless yn
23
23
  return @ssl_params = yn if Hash === yn
24
- @ssl_params = {} unless @ssl_params
24
+ @ssl_params ||= {}
25
25
  end
26
26
 
27
27
  def buffered=(yn)
@@ -27,7 +27,7 @@ module IOTimeoutMixin
27
27
  private
28
28
 
29
29
  def read_all(nbytes)
30
- return '' if nbytes == 0
30
+ return '' if 0 == nbytes
31
31
  result = ''
32
32
  loop do
33
33
  unless read = yield(nbytes - result.bytesize)
@@ -13,7 +13,12 @@ class TCPClient
13
13
  def initialize(socket, address, configuration, exception)
14
14
  ssl_params = Hash[configuration.ssl_params]
15
15
  super(socket, create_context(ssl_params))
16
- connect_to(address, configuration.connect_timeout, exception)
16
+ connect_to(
17
+ address,
18
+ ssl_params[:verify_mode] != OpenSSL::SSL::VERIFY_NONE,
19
+ configuration.connect_timeout,
20
+ exception
21
+ )
17
22
  end
18
23
 
19
24
  private
@@ -24,10 +29,10 @@ class TCPClient
24
29
  ctx
25
30
  end
26
31
 
27
- def connect_to(address, timeout, exception)
32
+ def connect_to(address, check, timeout, exception)
28
33
  self.hostname = address.hostname
29
34
  timeout ? with_deadline(Time.now + timeout, exception){ connect_nonblock(exception: false) } : connect
30
- post_connection_check(address.hostname)
35
+ post_connection_check(address.hostname) if check
31
36
  end
32
37
  end
33
38
 
@@ -1,3 +1,3 @@
1
1
  class TCPClient
2
- VERSION = '0.0.5'.freeze
2
+ VERSION = '0.0.6'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tcp-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Blumtritt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-20 00:00:00.000000000 Z
11
+ date: 2018-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler