mirror of
https://github.com/alexbers/mtprotoproxy.git
synced 2026-03-14 07:13:09 +00:00
automaticaly increase open file limit on start
This commit is contained in:
@@ -11,6 +11,7 @@ import random
|
|||||||
import binascii
|
import binascii
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from Crypto.Cipher import AES
|
from Crypto.Cipher import AES
|
||||||
from Crypto.Util import Counter
|
from Crypto.Util import Counter
|
||||||
@@ -48,6 +49,16 @@ except ImportError:
|
|||||||
return EncryptorAdapter(mode)
|
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
|
import config
|
||||||
PORT = getattr(config, "PORT")
|
PORT = getattr(config, "PORT")
|
||||||
USERS = getattr(config, "USERS")
|
USERS = getattr(config, "USERS")
|
||||||
|
|||||||
Reference in New Issue
Block a user