Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PyAMQP] Connections TODO #26018

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,10 @@ def _incoming_open(self, channel, frame):
self._outgoing_open()
self._set_state(ConnectionState.OPENED)
else:
pass # TODO what now...?
self.close(error=AMQPError(
condition=ErrorCondition.IllegalState,
description=f"connection is an illegal state: {self.state}"))
_LOGGER.error("connection is an illegal state: %r", self.state)

def _outgoing_close(self, error=None):
# type: (Optional[AMQPError]) -> None
Expand Down Expand Up @@ -506,10 +509,12 @@ def _incoming_end(self, channel, frame):
"""
try:
self._incoming_endpoints[channel]._incoming_end(frame) # pylint:disable=protected-access
self._incoming_endpoints.pop(channel)
self._outgoing_endpoints.pop(channel)
except KeyError:
pass # TODO: channel error
#self._incoming_endpoints.pop(channel) # TODO If we don't clean up channels - this will
#self._outgoing_endpoints.pop(channel) # TODO eventually crash
end_error = AMQPError(condition=ErrorCondition.InvalidField, description=f"Invalid channel {channel}", info=None)
_LOGGER.error(f"Invalid channel {channel} ")
self.close(error=end_error)

def _process_incoming_frame(self, channel, frame): # pylint:disable=too-many-return-statements
# type: (int, Optional[Union[bytes, Tuple[int, Tuple[Any, ...]]]]) -> bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,10 @@ async def _incoming_open(self, channel, frame):
await self._outgoing_open()
await self._set_state(ConnectionState.OPENED)
else:
pass # TODO what now...?
await self.close(error=AMQPError(
condition=ErrorCondition.IllegalState,
description=f"connection is an illegal state: {self.state}"))
_LOGGER.error("connection is an illegal state: %r", self.state)

async def _outgoing_close(self, error=None):
# type: (Optional[AMQPError]) -> None
Expand Down Expand Up @@ -475,10 +478,12 @@ async def _incoming_end(self, channel, frame):
"""
try:
await self._incoming_endpoints[channel]._incoming_end(frame) # pylint:disable=protected-access
self.incoming_endpoints.pop(channel)
self.outgoing_endpoints.pop(channel)
except KeyError:
pass # TODO: channel error
#self._incoming_endpoints.pop(channel) # TODO If we don't clean up channels - this will
#self._outgoing_endpoints.pop(channel) # TODO eventually crash
end_error = AMQPError(condition=ErrorCondition.InvalidField, description=f"Invalid channel {channel}", info=None)
_LOGGER.error(f"Invalid channel {channel} ")
await self.close(error=end_error)

async def _process_incoming_frame(self, channel, frame): # pylint:disable=too-many-return-statements
# type: (int, Optional[Union[bytes, Tuple[int, Tuple[Any, ...]]]]) -> bool
Expand Down