fhttpy/modules/connlimit.py

11 lines
309 B
Python
Raw Permalink Normal View History

2022-02-14 21:43:12 +00:00
def main():
def onConnectionEvent(event,eEnv,connection,address):
count = 0
with clientDataLock:
for cID in clientData:
if getClientData(cID,"address") == address:
count += 1
if count >= maxConnections: return False
return True
addEventHandler("onConnection",onConnectionEvent)
main()