Author: gsim Date: Wed Oct 1 19:41:56 2014 New Revision: 1628818 URL: http://svn.apache.org/r1628818 Log: Further cleanup
Modified: qpid/proton/branches/examples/tutorial/helloworld_direct_alt.py qpid/proton/branches/examples/tutorial/proton_events.py Modified: qpid/proton/branches/examples/tutorial/helloworld_direct_alt.py URL: http://svn.apache.org/viewvc/qpid/proton/branches/examples/tutorial/helloworld_direct_alt.py?rev=1628818&r1=1628817&r2=1628818&view=diff ============================================================================== --- qpid/proton/branches/examples/tutorial/helloworld_direct_alt.py (original) +++ qpid/proton/branches/examples/tutorial/helloworld_direct_alt.py Wed Oct 1 19:41:56 2014 @@ -19,14 +19,14 @@ # from proton import Message -from proton_events import ErrorHandler, EventLoop, FlowController, Handshaker, IncomingMessageHandler, OutgoingMessageHandler +from proton_events import BaseHandler, EventLoop, FlowController, Handshaker -class HelloWorldReceiver(IncomingMessageHandler): +class HelloWorldReceiver(BaseHandler): def on_message(self, event): print event.message.body event.connection.close() -class HelloWorld(ErrorHandler, OutgoingMessageHandler): +class HelloWorld(BaseHandler): def __init__(self, eventloop, url, address): self.eventloop = eventloop self.acceptor = eventloop.listen(url) Modified: qpid/proton/branches/examples/tutorial/proton_events.py URL: http://svn.apache.org/viewvc/qpid/proton/branches/examples/tutorial/proton_events.py?rev=1628818&r1=1628817&r2=1628818&view=diff ============================================================================== --- qpid/proton/branches/examples/tutorial/proton_events.py (original) +++ qpid/proton/branches/examples/tutorial/proton_events.py Wed Oct 1 19:41:56 2014 @@ -494,11 +494,14 @@ class ScopedDispatcher(EventDispatcher): h(event) class ErrorHandler(EventDispatcher): - def was_closed_by_peer(self, endpoint): - return endpoint.state & Endpoint.LOCAL_ACTIVE and endpoint.state & Endpoint.REMOTE_CLOSED + def was_closed_by_peer(self, endpoint, parent=None): + if parent: + return self.was_closed_by_peer(parent) and self.was_closed_by_peer(endpoint) + else: + return endpoint.state & Endpoint.LOCAL_ACTIVE and endpoint.state & Endpoint.REMOTE_CLOSED - def treat_as_error(self, endpoint): - return endpoint.remote_condition or self.was_closed_by_peer(endpoint) + def treat_as_error(self, endpoint, parent=None): + return endpoint.remote_condition or self.was_closed_by_peer(endpoint, parent) def print_error(self, endpoint, endpoint_type): if endpoint.remote_condition: @@ -507,11 +510,11 @@ class ErrorHandler(EventDispatcher): print "%s closed by peer" % endpoint_type def on_link_remote_close(self, event): - if self.treat_as_error(event.link): + if self.treat_as_error(event.link, event.connection): self.on_link_error(event) def on_session_remote_close(self, event): - if self.treat_as_error(event.session): + if self.treat_as_error(event.session, event.connection): self.on_session_error(event) def on_connection_remote_close(self, event): --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org