<commit_before>#!/usr/bin/env python3
#coding:utf8

import sys

# libpath

try:
    if (sys.version_info.major != 3) or (sys.version_info.minor < 4):
        raise Exception("You must run Syncplay with Python 3.4 or newer!")
except AttributeError:
    import warnings
    warnings.warn("You must run Syncplay with Python 3.4 or newer!")

from twisted.internet.endpoints import TCP6ServerEndpoint
from twisted.internet import reactor

from syncplay.server import SyncFactory, ConfigurationGetter

if __name__ == '__main__':
    argsGetter = ConfigurationGetter()
    args = argsGetter.getConfiguration()
    endpoint = TCP6ServerEndpoint(reactor, int(args.port))
    endpoint.listen(
        SyncFactory(
            args.port,
            args.password,
            args.motd_file,
            args.isolate_rooms,
            args.salt,
            args.disable_ready,
            args.disable_chat,
            args.max_chat_message_length,
            args.max_username_length,
            args.stats_db_file))
    reactor.run()<commit_msg>IPv6: revert to listenTCP and override createInternetSocket to have a dual stack server<commit_after>#!/usr/bin/env python3
#coding:utf8

import socket
import sys

# libpath

try:
    if (sys.version_info.major != 3) or (sys.version_info.minor < 4):
        raise Exception("You must run Syncplay with Python 3.4 or newer!")
except AttributeError:
    import warnings
    warnings.warn("You must run Syncplay with Python 3.4 or newer!")

from twisted.internet import reactor, tcp

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)
        s.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0)
        return s

if __name__ == '__main__':
    argsGetter = ConfigurationGetter()
    args = argsGetter.getConfiguration()
    dsp = DualStackPort(int(args.port),
        SyncFactory(
            args.port,
            args.password,
            args.motd_file,
            args.isolate_rooms,
            args.salt,
            args.disable_ready,
            args.disable_chat,
            args.max_chat_message_length,
            args.max_username_length,
            args.stats_db_file),
        interface='::')
    dsp.startListening()
    reactor.run()
{'fraction_non_alphanumeric': 0.09061619009262989, 'fraction_numerical': 0.010068465565847765, 'mean_word_length': 2.7981651376146788, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7203150', 'n_tokens_mistral': 758, 'n_tokens_neox': 732, 'n_words': 178}