mirror of
https://github.com/solero/houdini.git
synced 2024-11-22 05:27:23 +00:00
Implement AbortHandlerChain
exception for aborting future handlers
This commit is contained in:
parent
bc059bacb8
commit
f4d4044a04
@ -13,6 +13,10 @@ class AuthorityError(Exception):
|
|||||||
"""Raised when a packet is received but user has not yet authenticated"""
|
"""Raised when a packet is received but user has not yet authenticated"""
|
||||||
|
|
||||||
|
|
||||||
|
class AbortHandlerChain(Exception):
|
||||||
|
"""Exception raised when handler wants to abort the rest of the handler chain"""
|
||||||
|
|
||||||
|
|
||||||
class _Packet:
|
class _Packet:
|
||||||
__slots__ = ['id']
|
__slots__ = ['id']
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ from xml.etree.cElementTree import Element, SubElement, tostring
|
|||||||
import defusedxml.cElementTree as Et
|
import defusedxml.cElementTree as Et
|
||||||
|
|
||||||
from houdini.constants import ClientType
|
from houdini.constants import ClientType
|
||||||
from houdini.handlers import AuthorityError, XMLPacket, XTPacket
|
from houdini.handlers import AuthorityError, AbortHandlerChain, XMLPacket, XTPacket
|
||||||
|
|
||||||
|
|
||||||
class Spheniscidae:
|
class Spheniscidae:
|
||||||
@ -161,6 +161,8 @@ class Spheniscidae:
|
|||||||
await self.__handle_xt_data(data)
|
await self.__handle_xt_data(data)
|
||||||
except AuthorityError:
|
except AuthorityError:
|
||||||
self.logger.debug(f'{self} tried to send game packet before authentication')
|
self.logger.debug(f'{self} tried to send game packet before authentication')
|
||||||
|
except AbortHandlerChain as e:
|
||||||
|
self.logger.info(f'Handler chain aborted: {str(e)}')
|
||||||
|
|
||||||
async def run(self):
|
async def run(self):
|
||||||
await self._client_connected()
|
await self._client_connected()
|
||||||
|
Loading…
Reference in New Issue
Block a user