-
Notifications
You must be signed in to change notification settings - Fork 517
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2600 from usingtechnology/issue-2530-abandoned-co…
…nnection Add ConnectionProblemReport handler
- Loading branch information
Showing
10 changed files
with
150 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
aries_cloudagent/protocols/connections/v1_0/handlers/problem_report_handler.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
"""Problem report handler for Connection Protocol.""" | ||
|
||
from .....messaging.base_handler import ( | ||
BaseHandler, | ||
BaseResponder, | ||
HandlerException, | ||
RequestContext, | ||
) | ||
from ..manager import ConnectionManager, ConnectionManagerError | ||
from ..messages.problem_report import ConnectionProblemReport | ||
|
||
|
||
class ConnectionProblemReportHandler(BaseHandler): | ||
"""Handler class for Connection problem report messages.""" | ||
|
||
async def handle(self, context: RequestContext, responder: BaseResponder): | ||
"""Handle problem report message.""" | ||
self._logger.debug( | ||
f"ConnectionProblemReportHandler called with context {context}" | ||
) | ||
assert isinstance(context.message, ConnectionProblemReport) | ||
|
||
self._logger.info(f"Received problem report: {context.message.problem_code}") | ||
profile = context.profile | ||
mgr = ConnectionManager(profile) | ||
try: | ||
if context.connection_record: | ||
await mgr.receive_problem_report( | ||
context.connection_record, context.message | ||
) | ||
else: | ||
raise HandlerException("No connection established for problem report") | ||
except ConnectionManagerError: | ||
# Unrecognized problem report code | ||
self._logger.exception("Error receiving Connection problem report") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.