mirror of
https://github.com/solero/houdini.git
synced 2024-12-23 22:13:38 +00:00
Reject client authentication if server is full
This commit is contained in:
parent
6cc7219572
commit
79a7724756
@ -18,6 +18,9 @@ handle_random_key = login.handle_random_key
|
|||||||
@handlers.allow_once
|
@handlers.allow_once
|
||||||
@handlers.depends_on_packet(XMLPacket('verChk'), XMLPacket('rndK'))
|
@handlers.depends_on_packet(XMLPacket('verChk'), XMLPacket('rndK'))
|
||||||
async def handle_login(p, credentials: WorldCredentials):
|
async def handle_login(p, credentials: WorldCredentials):
|
||||||
|
if len(p.server.penguins_by_id) >= p.server.server_config['Capacity']:
|
||||||
|
return await p.send_error_and_disconnect(103)
|
||||||
|
|
||||||
tr = p.server.redis.multi_exec()
|
tr = p.server.redis.multi_exec()
|
||||||
tr.get('{}.lkey'.format(credentials.username))
|
tr.get('{}.lkey'.format(credentials.username))
|
||||||
tr.get('{}.ckey'.format(credentials.username))
|
tr.get('{}.ckey'.format(credentials.username))
|
||||||
@ -65,6 +68,9 @@ async def handle_login(p, credentials: WorldCredentials):
|
|||||||
@handlers.allow_once
|
@handlers.allow_once
|
||||||
@handlers.depends_on_packet(XMLPacket('verChk'), XMLPacket('rndK'))
|
@handlers.depends_on_packet(XMLPacket('verChk'), XMLPacket('rndK'))
|
||||||
async def handle_legacy_login(p, credentials: Credentials):
|
async def handle_legacy_login(p, credentials: Credentials):
|
||||||
|
if len(p.server.penguins_by_id) >= p.server.server_config['Capacity']:
|
||||||
|
return await p.send_error_and_disconnect(103)
|
||||||
|
|
||||||
tr = p.server.redis.multi_exec()
|
tr = p.server.redis.multi_exec()
|
||||||
tr.get('{}.lkey'.format(credentials.username))
|
tr.get('{}.lkey'.format(credentials.username))
|
||||||
tr.delete('{}.lkey'.format(credentials.username), '{}.ckey'.format(credentials.username))
|
tr.delete('{}.lkey'.format(credentials.username), '{}.ckey'.format(credentials.username))
|
||||||
|
Loading…
Reference in New Issue
Block a user