mirror of
https://github.com/alexbers/mtprotoproxy.git
synced 2026-03-13 23:03:09 +00:00
automaticaly increase open file limit on start
This commit is contained in:
@@ -11,6 +11,7 @@ import random
|
||||
import binascii
|
||||
import sys
|
||||
|
||||
|
||||
try:
|
||||
from Crypto.Cipher import AES
|
||||
from Crypto.Util import Counter
|
||||
@@ -48,6 +49,16 @@ except ImportError:
|
||||
return EncryptorAdapter(mode)
|
||||
|
||||
|
||||
try:
|
||||
import resource
|
||||
soft_fd_limit, hard_fd_limit = resource.getrlimit(resource.RLIMIT_NOFILE)
|
||||
resource.setrlimit(resource.RLIMIT_NOFILE, (hard_fd_limit, hard_fd_limit))
|
||||
except (ValueError, OSError):
|
||||
print("Failed to increase the limit of opened files", flush=True, file=sys.stderr)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
import config
|
||||
PORT = getattr(config, "PORT")
|
||||
USERS = getattr(config, "USERS")
|
||||
|
||||
Reference in New Issue
Block a user