Skip to content
This repository has been archived by the owner on Sep 10, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' of git://github.com/ltucker/greenamqp
Browse files Browse the repository at this point in the history
  • Loading branch information
jab committed Jan 14, 2010
2 parents 1445d8f + a7da040 commit 5f5ba80
Showing 1 changed file with 27 additions and 17 deletions.
44 changes: 27 additions & 17 deletions greenamqp/client_0_8/connection.py
Expand Up @@ -19,7 +19,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301

import logging
from eventlet.proc import spawn as spawn_proc
from eventlet.proc import spawn as spawn_proc, ProcExit

from abstract_channel import AbstractChannel
from channel import Channel
Expand All @@ -43,25 +43,34 @@
AMQP_LOGGER = logging.getLogger('greenamqp')

def method_reader(self):

reader = MethodReader(self.transport)
while True:
if self.transport is None:
return
try:
reader = MethodReader(self.transport)
while True:
if self.transport is None:
return

channel, method_sig, args, content = \
reader.read_method()
channel, method_sig, args, content = \
reader.read_method()

self.channels[channel].received_method(method_sig, args, content)

#
# If we just queued up a method for channel 0 (the Connection
# itself) it's probably a close method in reaction to some
# error, so deal with it right away.
#
# if channel == 0:
# self.wait()
self.channels[channel].received_method(method_sig, args, content)

#
# If we just queued up a method for channel 0 (the Connection
# itself) it's probably a close method in reaction to some
# error, so deal with it right away.
#
# if channel == 0:
# self.wait()
except IOError:
# this will happen if the connection is closed while reading
pass
except ProcExit:
# killed normally
raise
except:
AMQP_LOGGER.error("Unexpected error reading from connection: %s" %
traceback.format_exc())

class Connection(AbstractChannel):
"""
The connection class provides methods for a client to establish a
Expand Down Expand Up @@ -175,6 +184,7 @@ def __init__(self,

def _do_close(self):
self.method_reader_proc.kill()
self.method_reader.wait()
self.method_reader_proc = None

self.transport.close()
Expand Down

0 comments on commit 5f5ba80

Please sign in to comment.