fstream/modules/connlimit.py

11 lines
309 B
Python

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()