Skip to content

Commit

Permalink
Merge branch 'master' into ipv6-support
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonrbriggs committed Sep 6, 2015
2 parents bf678a2 + 898b9cb commit cc80841
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 27 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Version 4.1.6 - Aug 2015

* Generic exception catch on heartbeat send
*


Version 4.1.5 - Aug 2015

* Remove incorrect \r escaping from 1.1 protocol
Expand Down
2 changes: 1 addition & 1 deletion stomp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import stomp.connect as connect, stomp.listener as listener

__version__ = (4, 1, 5)
__version__ = (4, 1, 6)

##
# Alias for STOMP 1.0 connections.
Expand Down
2 changes: 1 addition & 1 deletion stomp/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ def main():
help = 'Enable SSL connection')

parser.set_defaults()
(options, args) = parser.parse_args()
(options, _) = parser.parse_args()

if options.verbose == 'on':
verbose = True
Expand Down
5 changes: 3 additions & 2 deletions stomp/listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ def __heartbeat_loop(self):
Main loop for sending (and monitoring received) heartbeats.
"""
send_time = time.time()
receive_time = time.time()

while self.running:
time.sleep(self.sleep_time)
Expand All @@ -245,11 +244,13 @@ def __heartbeat_loop(self):
self.transport.transmit(utils.Frame(None, {}, None))
except exception.NotConnectedException:
log.debug("Lost connection, unable to send heartbeat")
except Exception:
_, e, _ = sys.exc_info()
log.debug("Unable to send heartbeat, due to: %s" % e)

diff_receive = now - self.received_heartbeat

if diff_receive > self.receive_sleep:
receive_time = now
diff_heartbeat = now - self.received_heartbeat
if diff_heartbeat > self.receive_sleep:
# heartbeat timeout
Expand Down
10 changes: 5 additions & 5 deletions stomp/test/basic_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def test_clientack(self):

self.listener.wait_on_receipt()

(headers, msg) = self.listener.get_latest_message()
(headers, _) = self.listener.get_latest_message()

message_id = headers['message-id']
subscription = headers['subscription']
Expand All @@ -140,7 +140,7 @@ def test_clientnack(self):

self.listener.wait_on_receipt()

(headers, msg) = self.listener.get_latest_message()
(headers, _) = self.listener.get_latest_message()

message_id = headers['message-id']
subscription = headers['subscription']
Expand All @@ -161,10 +161,10 @@ def test_specialchars(self):

self.listener.wait_on_receipt()

(headers, msg) = self.listener.get_latest_message()
(headers, _) = self.listener.get_latest_message()

message_id = headers['message-id']
subscription = headers['subscription']
_ = headers['message-id']
_ = headers['subscription']
self.assert_('special-1' in headers)
self.assertEqual('test with colon : test', headers['special-1'])
self.assert_('special-2' in headers)
Expand Down
2 changes: 1 addition & 1 deletion stomp/test/p2_nonascii_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ def test_send_nonascii(self):
self.assert_(self.listener.messages == 1, 'should have received 1 message')
self.assert_(self.listener.errors == 0, 'should not have received any errors')

(headers, msg) = self.listener.get_latest_message()
(_, msg) = self.listener.get_latest_message()
self.assertEquals(stomp.backward.encode(txt), msg)

8 changes: 4 additions & 4 deletions stomp/test/p3_nonascii_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_send_nonascii(self):
self.assert_(self.listener.messages >= 1, 'should have received 1 message')
self.assert_(self.listener.errors == 0, 'should not have received any errors')

(headers, msg) = self.listener.get_latest_message()
(_, msg) = self.listener.get_latest_message()
self.assertEquals(stomp.backward.encode(txt), msg)

def test_image_send(self):
Expand All @@ -54,7 +54,7 @@ def test_image_send(self):
self.assert_(self.listener.messages >= 1, 'should have received 1 message')
self.assert_(self.listener.errors == 0, 'should not have received any errors')

(headers, msg) = self.listener.get_latest_message()
(_, msg) = self.listener.get_latest_message()
self.assertEquals(img, msg)
open(os.path.join(d, 'test-out.gif'), 'wb').write(img)

Expand Down Expand Up @@ -87,5 +87,5 @@ def test_send_nonascii_auto_encoding(self):
self.assert_(self.listener.messages >= 1, 'should have received 1 message')
self.assert_(self.listener.errors == 0, 'should not have received any errors')

(headers, msg) = self.listener.get_latest_message()
self.assertEquals(txt, msg)
(_, msg) = self.listener.get_latest_message()
self.assertEquals(txt, msg)
2 changes: 1 addition & 1 deletion stomp/test/s10_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def testclientack10(self):

self.listener.wait_for_message()

(headers, msg) = self.listener.get_latest_message()
(headers, _) = self.listener.get_latest_message()

message_id = headers['message-id']

Expand Down
10 changes: 5 additions & 5 deletions stomp/test/s12_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def testclientack12(self):

self.listener.wait_for_message()

(headers, msg) = self.listener.get_latest_message()
(headers, _) = self.listener.get_latest_message()

ack_id = headers['ack']

Expand All @@ -57,7 +57,7 @@ def testclientnack12(self):

self.listener.wait_for_message()

(headers, msg) = self.listener.get_latest_message()
(headers, _) = self.listener.get_latest_message()

ack_id = headers['ack']

Expand Down Expand Up @@ -98,10 +98,10 @@ def test_specialchars12(self):

self.listener.wait_on_receipt()

(headers, msg) = self.listener.get_latest_message()
(headers, _) = self.listener.get_latest_message()

message_id = headers['message-id']
subscription = headers['subscription']
_ = headers['message-id']
_ = headers['subscription']
self.assert_('special-1' in headers)
self.assertEqual('test with colon : test', headers['special-1'])
self.assert_('special-2' in headers)
Expand Down
2 changes: 1 addition & 1 deletion stomp/test/ss_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_disconnect(self):

server.stop()

for count in range(100):
for _ in range(100):
if server.stopped:
break
time.sleep(0.1)
Expand Down
4 changes: 2 additions & 2 deletions stomp/test/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ def add_frame(self, frame):
self.frames.append(frame)

def run(self):
self.conn, addr = self.s.accept()
self.conn, _ = self.s.accept()
while self.running:
try:
data = self.conn.recv(1024)
_ = self.conn.recv(1024)
frame = self.get_next_frame()
if self.conn is None:
break
Expand Down
2 changes: 1 addition & 1 deletion stomp/test/threading_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def tearDown(self):
break
print("Dead threads:", len(errs), "of", self.clients)
etype = {}
for ec, ev, tb in errs:
for ec, _, _ in errs:
if ec in etype:
etype[ec] = etype[ec] + 1
else:
Expand Down
3 changes: 1 addition & 2 deletions stomp/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def start(self):
"""
self.running = True
self.attempt_connection()
thread = self.create_thread_fc(self.__receiver_loop)
_ = self.create_thread_fc(self.__receiver_loop)
self.notify('connecting')

def stop(self):
Expand Down Expand Up @@ -326,7 +326,6 @@ def __read(self):
log.debug("socket read interrupted, restarting")
continue
except Exception:
_, e, _ = sys.exc_info()
c = b''
if len(c) == 0:
raise exception.ConnectionClosedException()
Expand Down
2 changes: 1 addition & 1 deletion stomp/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def is_localhost(host_and_port):
Return 1 if the specified host+port is a member of the 'localhost' list of hosts, 2 if not (predominately used
as a sort key.
"""
(host, port) = host_and_port
(host, _) = host_and_port
if host in LOCALHOST_NAMES:
return 1
else:
Expand Down

0 comments on commit cc80841

Please sign in to comment.