Only allow login packets to be sent once per-connection

This commit is contained in:
Ben 2019-05-04 22:49:46 +01:00
parent ffd70949fc
commit 5a77c09ac7
2 changed files with 3 additions and 0 deletions

View File

@ -16,6 +16,7 @@ from datetime import datetime
@Handlers.handler(XMLPacket('login')) @Handlers.handler(XMLPacket('login'))
@Handlers.allow_once()
async def handle_login(p, credentials: CredentialsConverter): async def handle_login(p, credentials: CredentialsConverter):
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()

View File

@ -4,6 +4,7 @@ from Houdini.Converters import VersionChkConverter
@Handlers.handler(XMLPacket('verChk')) @Handlers.handler(XMLPacket('verChk'))
@Handlers.allow_once()
async def handle_version_check(p, version: VersionChkConverter): async def handle_version_check(p, version: VersionChkConverter):
if not version == 153: if not version == 153:
await p.send_xml({'body': {'action': 'apiKO', 'r': '0'}}) await p.send_xml({'body': {'action': 'apiKO', 'r': '0'}})
@ -13,5 +14,6 @@ async def handle_version_check(p, version: VersionChkConverter):
@Handlers.handler(XMLPacket('rndK')) @Handlers.handler(XMLPacket('rndK'))
@Handlers.allow_once()
async def handle_random_key(p, data): async def handle_random_key(p, data):
await p.send_xml({'body': {'action': 'rndK', 'r': '-1'}, 'k': 'houdini'}) await p.send_xml({'body': {'action': 'rndK', 'r': '-1'}, 'k': 'houdini'})