Ejemplo n.º 1
0
    def __init__(self, handler=None, ID=None):

        self.handler = handler
        self.id = ID

        if not self.id:
            self.id = threading.current_thread().name

        if self.handler:
            self.platformtools = Platformtools()
            self.host = "http://%s:%s" % (config.get_local_ip(), config.get_setting("server.port"))
Ejemplo n.º 2
0
import sys
import threading
import time
from functools import wraps

sys.dont_write_bytecode = True
from platformcode import config

sys.path.append(os.path.join(config.get_runtime_path(), 'lib'))
from platformcode import platformtools, logger
import HTTPServer
import WebSocket

http_port = config.get_setting("server.port")
websocket_port = config.get_setting("websocket.port")
myip = config.get_local_ip()


def ThreadNameWrap(func):
    @wraps(func)
    def bar(*args, **kw):
        if "name" not in kw:
            kw['name'] = threading.current_thread().name
        return func(*args, **kw)

    return bar


threading.Thread.__init__ = ThreadNameWrap(threading.Thread.__init__)

if sys.version_info < (2, 7, 11):