Restore TCP4 and TCP6 server endpoints
This commit is contained in:
parent
e1af902f7c
commit
e35f34d3a9
@ -13,38 +13,28 @@ except AttributeError:
|
|||||||
import warnings
|
import warnings
|
||||||
warnings.warn("You must run Syncplay with Python 3.4 or newer!")
|
warnings.warn("You must run Syncplay with Python 3.4 or newer!")
|
||||||
|
|
||||||
from twisted.internet import reactor, tcp
|
from twisted.internet import reactor
|
||||||
|
from twisted.internet.endpoints import TCP4ServerEndpoint, TCP6ServerEndpoint
|
||||||
|
|
||||||
from syncplay.server import SyncFactory, ConfigurationGetter
|
from syncplay.server import SyncFactory, ConfigurationGetter
|
||||||
|
|
||||||
class DualStackPort(tcp.Port):
|
|
||||||
|
|
||||||
def __init__(self, port, factory, backlog=50, interface='', reactor=None):
|
|
||||||
tcp.Port.__init__(self, port, factory, backlog, interface, reactor)
|
|
||||||
|
|
||||||
def createInternetSocket(self):
|
|
||||||
s = tcp.Port.createInternetSocket(self)
|
|
||||||
try:
|
|
||||||
s.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
return s
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
argsGetter = ConfigurationGetter()
|
argsGetter = ConfigurationGetter()
|
||||||
args = argsGetter.getConfiguration()
|
args = argsGetter.getConfiguration()
|
||||||
dsp = DualStackPort(int(args.port),
|
factory = SyncFactory(
|
||||||
SyncFactory(
|
args.port,
|
||||||
args.port,
|
args.password,
|
||||||
args.password,
|
args.motd_file,
|
||||||
args.motd_file,
|
args.isolate_rooms,
|
||||||
args.isolate_rooms,
|
args.salt,
|
||||||
args.salt,
|
args.disable_ready,
|
||||||
args.disable_ready,
|
args.disable_chat,
|
||||||
args.disable_chat,
|
args.max_chat_message_length,
|
||||||
args.max_chat_message_length,
|
args.max_username_length,
|
||||||
args.max_username_length,
|
args.stats_db_file
|
||||||
args.stats_db_file),
|
)
|
||||||
interface='::')
|
endpoint4 = TCP4ServerEndpoint(reactor, int(args.port))
|
||||||
dsp.startListening()
|
endpoint4.listen(factory)
|
||||||
|
endpoint6 = TCP6ServerEndpoint(reactor, int(args.port))
|
||||||
|
endpoint6.listen(factory)
|
||||||
reactor.run()
|
reactor.run()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user