call increase_rlimits() when creating the service

This commit is contained in:
Brian Warner 2018-02-19 12:28:17 -08:00
parent f7b8c5b19a
commit 5a762b16ad

View File

@ -1,11 +1,12 @@
import os import os
from . import transit_server
from twisted.internet import reactor from twisted.internet import reactor
from twisted.python import usage from twisted.python import usage
from twisted.application.service import MultiService from twisted.application.service import MultiService
from twisted.application.internet import (TimerService, from twisted.application.internet import (TimerService,
StreamServerEndpointService) StreamServerEndpointService)
from twisted.internet import endpoints from twisted.internet import endpoints
from . import transit_server
from .increase_rlimits import increase_rlimits
LONGDESC = """\ LONGDESC = """\
This plugin sets up a 'Transit Relay' server for magic-wormhole. This service This plugin sets up a 'Transit Relay' server for magic-wormhole. This service
@ -29,6 +30,7 @@ class Options(usage.Options):
def makeService(config, reactor=reactor): def makeService(config, reactor=reactor):
increase_rlimits()
ep = endpoints.serverFromString(reactor, config["port"]) # to listen ep = endpoints.serverFromString(reactor, config["port"]) # to listen
log_file = (os.fdopen(int(config["log-fd"]), "w") log_file = (os.fdopen(int(config["log-fd"]), "w")
if config["log-fd"] is not None if config["log-fd"] is not None