stomp 1.4.3 → 1.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d3b0e0643f14d3e248a463fd9e7dda3bbf193c3c
4
- data.tar.gz: 3a0cc2781ddda5adec47b27085cbb4bd3154d7e3
3
+ metadata.gz: 138654f82256d2b0bf65dd034e2a2ec725eefb55
4
+ data.tar.gz: 72b543959edfb3122a83d7ed9e01b22f54225f72
5
5
  SHA512:
6
- metadata.gz: d9f5f664f9ef05288b5e237c4871ae61ec571e109eed6db1babda61fff7ca374b200b5f127a8b999c6becab0442a40d56987d0a896330180fcdd33d2e92ec28f
7
- data.tar.gz: f559956891901862a57db82e33439bc46796a5c30b5eb8cdad29bace81a8d88f111a49cb826f5362b15a3e6176176a7a2136ad57322d24c64ccb0cfff7ebd0c3
6
+ metadata.gz: 13af9a61a1843e1d08f99430287cd416dca94785287cc2542cfc7979bda7896e295c4085748a4daf8bce1064bfd01e11a2b4325ab60ee7310b8cc553bb504c02
7
+ data.tar.gz: b8ba033de3d30b6b1502a8e41e2d7015fe37dbb68b37c8e040ee9ec6fddcf2385a84e2295392bfa3eb7aafb93ab888087f17ee7136bf12c36b838410986a132e
@@ -1,5 +1,15 @@
1
1
  # Stomp Gem Change Log
2
2
 
3
+ ## 1.4.4 20170611
4
+
5
+ * Merge fix for issue 141.
6
+ * Fix broken MatReconnectAttempts
7
+ * Attempt to detect mismatched SSL port and params.
8
+ * Issue 139, add ssl checks to receive timeout logic.
9
+ * Eliminate assert_nothing_raised from tests.
10
+ * Add Artemis suport to standard test bed.
11
+ * Run JRuby tests more easily.
12
+
3
13
  ## 1.4.3 20160821
4
14
 
5
15
  * Quick fix of install failures. Do not try to use install 1.4.2.
data/README.md CHANGED
@@ -93,6 +93,7 @@ A Stomp URL must begin with 'stomp://' and can be in one of the following forms:
93
93
 
94
94
  See _CHANGELOG.rdoc_ for details.
95
95
 
96
+ * Gem version 1.4.4. Miscellaneous fixes, see CHANGELOG.rdoc for details.
96
97
  * Gem version 1.4.3. Fix broken install. Do not try to install 1.4.2.
97
98
  * Gem version 1.4.2. Fix memory leak, and others !: see CHANGELOG.md for details.
98
99
  * Gem version 1.4.1. Important SSL changes !: see CHANGELOG.md for details.
@@ -293,7 +294,7 @@ Thiago Morello
293
294
  2009-12-25
294
295
  </td>
295
296
  <td style="border: 1px solid black;padding-left: 10px;" >
296
- (0369)
297
+ (0387)
297
298
  </td>
298
299
  <td style="border: 1px solid black;padding-left: 10px;" >
299
300
  <span style="font-weight: bold;" >
@@ -321,7 +322,7 @@ Rafael Rosa
321
322
  2010-03-23
322
323
  </td>
323
324
  <td style="border: 1px solid black;padding-left: 10px;" >
324
- (0024)
325
+ (0042)
325
326
  </td>
326
327
  <td style="border: 1px solid black;padding-left: 10px;" >
327
328
  <span style="font-weight: bold;" >
@@ -727,7 +728,7 @@ Nikolay Khasanov
727
728
  2016-07-16
728
729
  </td>
729
730
  <td style="border: 1px solid black;padding-left: 10px;" >
730
- (0004)
731
+ (0006)
731
732
  </td>
732
733
  <td style="border: 1px solid black;padding-left: 10px;" >
733
734
  <span style="font-weight: bold;" >
@@ -764,4 +765,46 @@ Alexandre Moutot
764
765
  / a.moutot@alphalink.fr
765
766
  </td>
766
767
  </tr>
768
+ <tr>
769
+ <td style="border: 1px solid black;padding-left: 10px;" >
770
+ 2016-10-25
771
+ </td>
772
+ <td style="border: 1px solid black;padding-left: 10px;" >
773
+ (0001)
774
+ </td>
775
+ <td style="border: 1px solid black;padding-left: 10px;" >
776
+ <span style="font-weight: bold;" >
777
+ Raducu Deaconu
778
+ </span>
779
+ / raducu.deaconu@visma.com
780
+ </td>
781
+ </tr>
782
+ <tr>
783
+ <td style="border: 1px solid black;padding-left: 10px;" >
784
+ 2017-03-23
785
+ </td>
786
+ <td style="border: 1px solid black;padding-left: 10px;" >
787
+ (0001)
788
+ </td>
789
+ <td style="border: 1px solid black;padding-left: 10px;" >
790
+ <span style="font-weight: bold;" >
791
+ Steve Traylen
792
+ </span>
793
+ / steve.traylen@cern.ch
794
+ </td>
795
+ </tr>
796
+ <tr>
797
+ <td style="border: 1px solid black;padding-left: 10px;" >
798
+ 2017-06-01
799
+ </td>
800
+ <td style="border: 1px solid black;padding-left: 10px;" >
801
+ (0001)
802
+ </td>
803
+ <td style="border: 1px solid black;padding-left: 10px;" >
804
+ <span style="font-weight: bold;" >
805
+ Michael Smith
806
+ </span>
807
+ / michael.smith@puppet.com
808
+ </td>
809
+ </tr>
767
810
  </table>
@@ -0,0 +1,41 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require 'logger' # use the standard Ruby logger .....
4
+ #
5
+ class Slogger
6
+
7
+ # Initialize a new callback logger instance.
8
+ def initialize(init_parms = nil)
9
+ _init
10
+ @log.info("Logger initialization complete.")
11
+ end
12
+
13
+ def _init
14
+ @log = Logger::new(STDERR) # User preference
15
+ @log.level = Logger::DEBUG # User preference
16
+ end
17
+
18
+ # Log connecting events
19
+ def on_connecting(parms)
20
+ begin
21
+ @log.debug "Connecting: #{parms}"
22
+ rescue Exception => ex
23
+ @log.debug "Connecting oops"
24
+ print ex.backtrace.join("\n")
25
+ end
26
+ end
27
+
28
+ # Log connected events
29
+ def on_connected(parms)
30
+ begin
31
+ @log.debug "Connected: #{parms}"
32
+ rescue Exception => ex
33
+ @log.debug "Connected oops"
34
+ print ex.backtrace.join("\n")
35
+ end
36
+ end
37
+
38
+ private
39
+
40
+ end # of class
41
+
@@ -0,0 +1,66 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ require 'stomp'
4
+ #
5
+ class CliWaiter
6
+
7
+ @@retry_num = 0
8
+ @@max_retries = 3
9
+
10
+ # Initialize.
11
+ def initialize # Change the following as needed.
12
+ @gem_retries = false
13
+ @host = ENV['STOMP_HOST'] ? ENV['STOMP_HOST'] : "localhost"
14
+ @port = ENV['STOMP_PORT'] ? ENV['STOMP_PORT'].to_i : 31613 # Artemis here
15
+ @slt = 75
16
+ @ver = ENV['STOMP_PROTOCOL'] ? ENV['STOMP_PROTOCOL'] : "1.2"
17
+ @hbdata = ENV['STOMP_HEARTBEATS'] ? ENV['STOMP_HEARTBEATS'] : "0,0"
18
+ @conn_hdrs = {"accept-version" => @ver, # version
19
+ "host" => "localhost", # vhost
20
+ "heart-beat" => @hbdata, # heartbeats
21
+ }
22
+ @hash = { :hosts => [
23
+ {:login => 'guest', :passcode => 'guest', :host => @host, :port => @port},
24
+ ],
25
+ :reliable => @gem_retries, # reliable controls retries by the gem
26
+ :autoflush => true,
27
+ :connect_headers => @conn_hdrs,
28
+ }
29
+ p [ "DB1", @hash ]
30
+ @do_retry=true # Retry ourself, gem code will not because of :reliable =>
31
+ end
32
+ # Run example.
33
+ def run
34
+ begin
35
+ @@retry_num += 1
36
+ puts "Try Number: #{@@retry_num}"
37
+ puts "Connect host: #{@host}, port: #{@port}"
38
+ puts "Connect hash: #{@hash.inspect}"
39
+ #
40
+ puts "CliWaiter Starts"
41
+ c = Stomp::Client.new(@hash)
42
+ #
43
+ puts "CliWaiter Sleeps: #{@slt} seconds"
44
+ sleep @slt
45
+ #
46
+ c.close
47
+ puts "CliWaiter Ends"
48
+ rescue Exception => ex
49
+ puts "Kaboom, we are in trouble"
50
+ puts "Exception Message: #{ex.message}"
51
+ puts "Exception Class: #{ex.class}"
52
+ puts "The gory details:"
53
+ print ex.backtrace.join("\n")
54
+ if @do_retry && @@retry_num < @@max_retries
55
+ retry
56
+ else
57
+ raise
58
+ end
59
+ end
60
+ end
61
+ end
62
+ #
63
+
64
+ #
65
+ e = CliWaiter.new
66
+ e.run
@@ -0,0 +1,61 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ require 'stomp'
4
+ #
5
+ if Kernel.respond_to?(:require_relative)
6
+ require_relative("artlogger")
7
+ else
8
+ $LOAD_PATH << File.dirname(__FILE__)
9
+ require "artlogger"
10
+ end
11
+ #
12
+ class CliWaiter
13
+
14
+ # Initialize.
15
+ def initialize # Change the following as needed.
16
+ #
17
+ mylog = Slogger::new # a stomp callback logger
18
+ #
19
+ @gem_retries = true
20
+ @host = ENV['STOMP_HOST'] ? ENV['STOMP_HOST'] : "localhost"
21
+ @port = ENV['STOMP_PORT'] ? ENV['STOMP_PORT'].to_i : 31613 # Artemis here
22
+ @slt = 75
23
+ @ver = ENV['STOMP_PROTOCOL'] ? ENV['STOMP_PROTOCOL'] : "1.2"
24
+ @hbdata = ENV['STOMP_HEARTBEATS'] ? ENV['STOMP_HEARTBEATS'] : "0,0"
25
+ @conn_hdrs = {"accept-version" => @ver, # version
26
+ "host" => "localhost", # vhost
27
+ "heart-beat" => @hbdata, # heartbeats
28
+ }
29
+ @hash = { :hosts => [
30
+ {:login => 'guest', :passcode => 'guest', :host => @host, :port => @port},
31
+ ],
32
+ :reliable => @gem_retries, # reliable controls retries by the gem
33
+ :logger => mylog, # This enables callback logging!
34
+ :autoflush => true,
35
+ :connect_headers => @conn_hdrs,
36
+ :initial_reconnect_delay => 1.0, # initial delay before reconnect (secs)
37
+ :use_exponential_back_off => false, # don't backoff
38
+ :max_reconnect_attempts => 3, # retry 3 times
39
+ }
40
+ end
41
+ # Run example.
42
+ def run
43
+ puts "Connect host: #{@host}, port: #{@port}"
44
+ puts "Connect hash: #{@hash}"
45
+ #
46
+ puts "CliWaiter Starts"
47
+ c = Stomp::Client.new(@hash)
48
+ #
49
+ while true
50
+ puts "CliWaiter Sleeps: #{@slt} seconds"
51
+ sleep @slt
52
+ end
53
+ #
54
+ c.close
55
+ end
56
+ end
57
+ #
58
+
59
+ #
60
+ e = CliWaiter.new
61
+ e.run
@@ -2,5 +2,5 @@
2
2
  #
3
3
  # git log --reverse --all --date=short --pretty --format='%aI;%cI;%cn;%ce' | \
4
4
  git log --reverse --all --date=short --pretty --format='%ad;%cd;%cn;%ce' | \
5
- ruby examples/contributors.rb
6
-
5
+ ruby $HOME/bin/contributors.rb
6
+
@@ -102,9 +102,11 @@ class Slogger
102
102
  @log.debug "Connect Fail oops"
103
103
  end
104
104
  =begin
105
- # An example LoggerConnectionError raise
106
- @log.debug "Connect Fail, will raise"
107
- raise Stomp::Error::LoggerConnectionError.new("quit from connect fail")
105
+ rescue
106
+ # An example LoggerConnectionError raise
107
+ @log.debug "Connect Fail, will raise"
108
+ raise Stomp::Error::LoggerConnectionError.new("quit from connect fail")
109
+ end
108
110
  =end
109
111
  end
110
112
 
@@ -33,7 +33,10 @@ class ExampleSSL1
33
33
  # Run example.
34
34
  def run
35
35
  puts "Connect host: #{@host}, port: #{@port}"
36
- ssl_opts = Stomp::SSLParams.new
36
+
37
+ ssl_opts = Stomp::SSLParams.new # or ssl_opts = true (for this use case)
38
+ #### ssl_opts = false # for testing HandShakeDetectedError exception
39
+
37
40
  hash = { :hosts => [
38
41
  {:login => 'guest', :passcode => 'guest', :host => @host, :port => @port, :ssl => ssl_opts},
39
42
  ],
@@ -52,4 +55,3 @@ end
52
55
  #
53
56
  e = ExampleSSL1.new
54
57
  e.run
55
-
@@ -25,12 +25,15 @@ module Stomp
25
25
  url = regexp.match(login)
26
26
  $VERBOSE = original_verbose
27
27
  return false unless url
28
-
28
+ @login = url[3] || ""
29
+ @passcode = url[4] || ""
30
+ @host = url[5]
31
+ @port = url[6].to_i
29
32
  @parameters = { :reliable => false,
30
- :hosts => [ { :login => url[3] || "",
31
- :passcode => url[4] || "",
32
- :host => url[5],
33
- :port => url[6].to_i} ] }
33
+ :hosts => [ { :login => @login,
34
+ :passcode => @passcode,
35
+ :host => @host,
36
+ :port => @port} ] }
34
37
  true
35
38
  end
36
39
 
@@ -78,6 +81,7 @@ module Stomp
78
81
  def build_subscription_id(destination, headers)
79
82
  return headers[:id] until headers[:id].nil?
80
83
  return headers['id'] until headers['id'].nil?
84
+ # p [ "DBBSID1", destination, headers ]
81
85
  Digest::SHA1.hexdigest(destination)
82
86
  end
83
87
 
@@ -106,7 +110,7 @@ module Stomp
106
110
  @parameters[:hosts].each do |hv|
107
111
  # Validate port requested
108
112
  raise ArgumentError.new("empty :port value in #{hv.inspect}") if hv[:port] == ''
109
- unless hv[:port].nil?
113
+ unless hv[:port].nil?
110
114
  tpv = hv[:port].to_i
111
115
  raise ArgumentError.new("invalid :port value=#{tpv} from #{hv.inspect}") if tpv < 1 || tpv > 65535
112
116
  end
@@ -204,4 +208,3 @@ module Stomp
204
208
  end # class Client
205
209
 
206
210
  end # module Stomp
207
-
@@ -107,9 +107,9 @@ module Stomp
107
107
  compval = (@hbsend_interval - (@hbsend_interval/5.0)) / 1000000.0
108
108
  if delta > compval || first_time
109
109
  first_time = false
110
- slog(:on_hbfire, log_params, "send_heartbeat", :last_sleep => slt,
110
+ slog(:on_hbfire, log_params, "send_heartbeat", {:last_sleep => slt,
111
111
  :curt => curt, :last_send => @ls, :delta => delta,
112
- :compval => compval)
112
+ :compval => compval})
113
113
  # Send a heartbeat
114
114
  @transmit_semaphore.synchronize do
115
115
  begin
@@ -194,7 +194,8 @@ module Stomp
194
194
  slog(:on_hbread_fail, log_params, {"ticker_interval" => sleeptime,
195
195
  "read_fail_count" => read_fail_count,
196
196
  "lock_fail" => false,
197
- "lock_fail_count" => lock_fail_count})
197
+ "lock_fail_count" => lock_fail_count,
198
+ "fail_point" => "not_ready"})
198
199
  end
199
200
  else # try_lock failed
200
201
  # Shrug. Could not get lock. Client must be actually be reading.
@@ -204,7 +205,8 @@ module Stomp
204
205
  slog(:on_hbread_fail, log_params, {"ticker_interval" => sleeptime,
205
206
  "read_fail_count" => read_fail_count,
206
207
  "lock_fail" => true,
207
- "lock_fail_count" => lock_fail_count})
208
+ "lock_fail_count" => lock_fail_count,
209
+ "fail_point" => "try_lock_fail"})
208
210
  end # of the try_lock
209
211
 
210
212
  else # delta <= sleeptime
@@ -216,7 +218,8 @@ module Stomp
216
218
  slog(:on_hbread_fail, log_params, {"ticker_interval" => sleeptime,
217
219
  "exception" => recvex,
218
220
  "read_fail_count" => read_fail_count,
219
- "lock_fail_count" => lock_fail_count})
221
+ "lock_fail_count" => lock_fail_count,
222
+ "fail_point" => "receive_exception"})
220
223
  fail_hard = true
221
224
  end
222
225
  # Do we want to attempt a retry?
@@ -227,17 +230,17 @@ module Stomp
227
230
  # This is an attempt at a connection retry.
228
231
  @st.kill if @st # Kill the sender thread if one exists
229
232
  _reconn_prep_hb() # Drive reconnection logic
230
- Thread.exit # This receiver thread is done
233
+ Thread.exit # This receiver thread is done
231
234
  end
232
235
  # Retry on max lock fails. Different logic in order to avoid a deadlock.
233
236
  if (@max_hbrlck_fails > 0 && lock_fail_count >= @max_hbrlck_fails)
234
237
  # This is an attempt at a connection retry.
235
- begin
236
- @socket.close # Attempt a forced close
237
- rescue
238
+ @gets_semaphore.synchronize do
239
+ @getst.raise(Errno::EBADF.new) if @getst # kill the socket reading thread if exists
240
+ @socket.close rescue nil # Attempt a forced close
238
241
  end
239
242
  @st.kill if @st # Kill the sender thread if one exists
240
- Thread.exit # This receiver thread is done
243
+ Thread.exit # This receiver thread is done
241
244
  end
242
245
  end
243
246
  Thread.pass # Prior to next receive loop
@@ -259,4 +262,3 @@ module Stomp
259
262
  end # class Connection
260
263
 
261
264
  end # module Stomp
262
-
@@ -9,6 +9,17 @@ module Stomp
9
9
 
10
10
  class Connection
11
11
 
12
+ def _interruptible_gets(read_socket)
13
+ # The gets thread may be interrupted by the heartbeat thread. Ensure that
14
+ # if so interrupted, a new gets cannot start until after the heartbeat
15
+ # thread finishes its work. This is PURELY to avoid a segfault bug
16
+ # involving OpenSSL::Buffer.
17
+ @gets_semaphore.synchronize { @getst = Thread.current }
18
+ read_socket.gets
19
+ ensure
20
+ @gets_semaphore.synchronize { @getst = nil }
21
+ end
22
+
12
23
  private
13
24
 
14
25
  # Really read from the wire.
@@ -40,6 +51,9 @@ module Stomp
40
51
  return nil if line.nil?
41
52
  #An extra \n at the beginning of the frame, possibly not caught by is_ready?
42
53
  line = '' if line == "\n"
54
+ if line == HAND_SHAKE_DATA
55
+ raise Stomp::Error::HandShakeDetectedError
56
+ end
43
57
  p [ "wiredatain_01A", line, Time.now ] if drdbg
44
58
  line = _normalize_line_end(line) if @protocol >= Stomp::SPL_12
45
59
  p [ "wiredatain_01B", line, Time.now ] if drdbg
@@ -48,11 +62,11 @@ module Stomp
48
62
  begin
49
63
  message_header += line
50
64
  p [ "wiredatain_02A", line, Time.now ] if drdbg
51
- unless connread
65
+ unless connread || @ssl
52
66
  raise Stomp::Error::ReceiveTimeout unless IO.select([read_socket], nil, nil, @iosto)
53
67
  end
54
68
  p [ "wiredatain_02B", line, Time.now ] if drdbg
55
- line = read_socket.gets
69
+ line = _interruptible_gets(read_socket)
56
70
  p [ "wiredatain_02C", line ] if drdbg
57
71
  raise if line.nil?
58
72
  line = _normalize_line_end(line) if @protocol >= Stomp::SPL_12
@@ -66,18 +80,18 @@ module Stomp
66
80
  p [ "wiredatain_03B", content_length ] if drdbg
67
81
  # If content_length is present, read the specified amount of bytes
68
82
  if content_length
69
- unless connread
83
+ unless connread || @ssl
70
84
  raise Stomp::Error::ReceiveTimeout unless IO.select([read_socket], nil, nil, @iosto)
71
85
  end
72
86
  p [ "CL01" ] if drdbg
73
87
  message_body = read_socket.read content_length[1].to_i
74
- unless connread
88
+ unless connread || @ssl
75
89
  raise Stomp::Error::ReceiveTimeout unless IO.select([read_socket], nil, nil, @iosto)
76
90
  end
77
91
  raise Stomp::Error::InvalidMessageLength unless parse_char(read_socket.getc) == "\0"
78
92
  # Else read the rest of the message until the first \0
79
93
  else
80
- unless connread
94
+ unless connread || @ssl
81
95
  raise Stomp::Error::ReceiveTimeout unless IO.select([read_socket], nil, nil, @iosto)
82
96
  end
83
97
  p [ "NOCL01" ] if drdbg
@@ -99,7 +113,7 @@ module Stomp
99
113
  # asynchronous nature of the 'poll' method.
100
114
  p [ "wiredatain_05_prep", "isr", _is_ready?(read_socket) ] if drdbg
101
115
  while _is_ready?(read_socket)
102
- unless connread
116
+ unless connread || @ssl
103
117
  raise Stomp::Error::ReceiveTimeout unless IO.select([read_socket], nil, nil, @iosto)
104
118
  end
105
119
  p [ "WHIR01" ] if drdbg
@@ -162,7 +176,7 @@ module Stomp
162
176
  # transmit logically puts a Message on the wire.
163
177
  def transmit(command, headers = {}, body = '')
164
178
  # The transmit may fail so we may need to retry.
165
- while TRUE
179
+ while true
166
180
  begin
167
181
  used_socket = socket()
168
182
  _transmit(used_socket, command, headers, body)
@@ -207,7 +221,7 @@ module Stomp
207
221
  # For more information refer to http://juretta.com/log/2009/05/24/activemq-jms-stomp/
208
222
  # Lets send this header in the message, so it can maintain state when using unreceive
209
223
  headers[:'content-length'] = "#{body_length_bytes}" unless headers[:suppress_content_length]
210
- headers[:'content-type'] = "text/plain; charset=UTF-8" unless headers[:'content-type']
224
+ headers[:'content-type'] = "text/plain; charset=UTF-8" unless headers[:'content-type'] || headers[:suppress_content_type]
211
225
  _wire_write(used_socket,command)
212
226
  headers.each do |k,v|
213
227
  if v.is_a?(Array)
@@ -219,7 +233,17 @@ module Stomp
219
233
  end
220
234
  end
221
235
  _wire_write(used_socket,"")
222
- used_socket.write body unless body == ''
236
+ if body != ''
237
+ if headers[:suppress_content_length]
238
+ if tz = body.index("\00")
239
+ used_socket.write body[0..tz-1]
240
+ else
241
+ used_socket.write body
242
+ end
243
+ else
244
+ used_socket.write body
245
+ end
246
+ end
223
247
  used_socket.write "\0"
224
248
  used_socket.flush if autoflush
225
249
 
@@ -332,7 +356,7 @@ module Stomp
332
356
  # Set SSLContext Options if user asks for it in Stomp::SSLParams
333
357
  # and SSL supports it.
334
358
  if @ssl.ssl_ctxopts && ctx.respond_to?(:options=)
335
- ctx.options = @ssl.ssl_ctxopts
359
+ ctx.options = @ssl.ssl_ctxopts
336
360
  end
337
361
 
338
362
  end
@@ -449,24 +473,24 @@ module Stomp
449
473
  if RUBY_VERSION < "2"
450
474
  while true
451
475
  ### p [ "ilrjr01A1", _is_ready?(read_socket) ]
452
- line = read_socket.gets # Data from wire
476
+ line = _interruptible_gets(read_socket) # Data from wire
453
477
  break unless line == "\n"
454
478
  line = ''
455
479
  end
456
480
  else # RUBY_VERSION >= "2"
457
481
  while _is_ready?(read_socket)
458
482
  ### p [ "ilrjr01B2", _is_ready?(read_socket) ]
459
- line = read_socket.gets # Data from wire
483
+ line = _interruptible_gets(read_socket) # Data from wire
460
484
  break unless line == "\n"
461
485
  line = ''
462
486
  end
463
487
  end
464
488
  else
465
- line = read_socket.gets # The old way
489
+ line = _interruptible_gets(read_socket) # The old way
466
490
  end
467
491
  else # We are >= 1.1 *AND* receiving heartbeats.
468
492
  while true
469
- line = read_socket.gets # Data from wire
493
+ line = _interruptible_gets(read_socket) # Data from wire
470
494
  break unless line == "\n"
471
495
  line = ''
472
496
  @lr = Time.now.to_f
@@ -490,6 +514,15 @@ module Stomp
490
514
  end
491
515
  end # _dump_callstack
492
516
 
517
+ # used for debugging
518
+ def _dump_threads()
519
+ tl = Thread::list
520
+ tl.each do |at|
521
+ p [ "THDMPN", at ]
522
+ end
523
+ p [ "THDMPMain", @parameters[:client_main] ]
524
+ end
525
+
493
526
  end # class Connection
494
527
 
495
528
  end # module Stomp