Example #1
0
    def init(self, opts):
        self.compression_level = opts.compression_level
        self.display = opts.display
        self.username = opts.username
        self.password = opts.password
        self.password_file = opts.password_file
        self.encryption = opts.encryption or opts.tcp_encryption
        if self.encryption:
            crypto_backend_init()
        self.encryption_keyfile = opts.encryption_keyfile or opts.tcp_encryption_keyfile
        self.quality = opts.quality
        self.min_quality = opts.min_quality
        self.speed = opts.speed
        self.min_speed = opts.min_speed
        #printing and file transfer:
        FileTransferHandler.init_opts(self, opts)

        if DETECT_LEAKS:
            from xpra.util import detect_leaks
            detailed = []
            #example: warning, uses ugly direct import:
            #try:
            #    from xpra.x11.bindings.ximage import XShmImageWrapper       #@UnresolvedImport
            #    detailed.append(XShmImageWrapper)
            #except:
            #    pass
            print_leaks = detect_leaks(log, detailed)
            self.timeout_add(10 * 1000, print_leaks)
Example #2
0
 def init_challenge_handlers(self, challenge_handlers):
     #register the authentication challenge handlers:
     authlog("init_challenge_handlers(%s)", challenge_handlers)
     ch = tuple(x.strip() for x in (challenge_handlers or "".split(",")))
     for ch_name in ch:
         if ch_name == "none":
             continue
         if ch_name == "all":
             items = (
                 "uri",
                 "file",
                 "env",
                 "kerberos",
                 "gss",
                 "u2f",
                 "prompt",
                 "prompt",
                 "prompt",
                 "prompt",
             )
             ierror = authlog
         else:
             items = (ch_name, )
             ierror = authlog.warn
         for auth in items:
             instance = self.get_challenge_handler(auth, ierror)
             if instance:
                 self.challenge_handlers.append(instance)
     if DETECT_LEAKS:
         from xpra.util import detect_leaks
         print_leaks = detect_leaks()
         self.timeout_add(10 * 1000, print_leaks)
Example #3
0
    def init(self, opts):
        self.compression_level = opts.compression_level
        self.display = opts.display
        self.username = opts.username
        self.password_file = opts.password_file
        self.encryption = opts.encryption
        self.encryption_keyfile = opts.encryption_keyfile
        self.quality = opts.quality
        self.min_quality = opts.min_quality
        self.speed = opts.speed
        self.min_speed = opts.min_speed
        self.file_transfer = opts.file_transfer
        self.file_size_limit = opts.file_size_limit
        self.printing = opts.printing
        self.open_command = opts.open_command
        self.open_files = opts.open_files

        if DETECT_LEAKS:
            from xpra.util import detect_leaks
            detailed = []
            #example: warning, uses ugly direct import:
            #try:
            #    from xpra.x11.bindings.ximage import XShmImageWrapper       #@UnresolvedImport
            #    detailed.append(XShmImageWrapper)
            #except:
            #    pass
            print_leaks = detect_leaks(log, detailed)
            self.timeout_add(10*1000, print_leaks)
Example #4
0
    def init(self, opts):
        self.compression_level = opts.compression_level
        self.display = opts.display
        self.username = opts.username
        self.password_file = opts.password_file
        self.encryption = opts.encryption
        self.encryption_keyfile = opts.encryption_keyfile
        self.quality = opts.quality
        self.min_quality = opts.min_quality
        self.speed = opts.speed
        self.min_speed = opts.min_speed
        self.file_transfer = opts.file_transfer
        self.file_size_limit = opts.file_size_limit
        self.printing = opts.printing
        self.open_command = opts.open_command
        self.open_files = opts.open_files

        if DETECT_LEAKS:
            from xpra.util import detect_leaks
            detailed = []
            #example: warning, uses ugly direct import:
            #try:
            #    from xpra.x11.bindings.ximage import XShmImageWrapper       #@UnresolvedImport
            #    detailed.append(XShmImageWrapper)
            #except:
            #    pass
            print_leaks = detect_leaks(log, detailed)
            self.timeout_add(10 * 1000, print_leaks)
Example #5
0
 def init(self, opts, _extra_args=()):
     if self._init_done:
         #the gtk client classes can inherit this method
         #from multiple parents, skip initializing twice
         return
     self._init_done = True
     for c in XpraClientBase.__bases__:
         c.init(self, opts)
     self.compression_level = opts.compression_level
     self.display = opts.display
     self.username = opts.username
     self.password = opts.password
     self.password_file = opts.password_file
     self.encryption = opts.encryption or opts.tcp_encryption
     if self.encryption:
         crypto_backend_init()
     self.encryption_keyfile = opts.encryption_keyfile or opts.tcp_encryption_keyfile
     #register the authentication challenge handlers:
     ch = tuple(x.strip().lower() for x in (opts.challenge_handlers or "").split(","))
     for ch_name in ch:
         if ch_name=="all":
             self.challenge_handlers.update(self.default_challenge_methods)
             break
         method = self.default_challenge_methods.get(ch_name)
         if method:
             self.challenge_handlers[ch_name] = method
             continue
         log.warn("Warning: unknown challenge handler '%s'", ch_name)
     if DETECT_LEAKS:
         from xpra.util import detect_leaks
         print_leaks = detect_leaks()
         self.timeout_add(10*1000, print_leaks)
Example #6
0
    def init(self, opts):
        self.compression_level = opts.compression_level
        self.display = opts.display
        self.username = opts.username
        self.password = opts.password
        self.password_file = opts.password_file
        self.encryption = opts.encryption or opts.tcp_encryption
        if self.encryption:
            crypto_backend_init()
        self.encryption_keyfile = opts.encryption_keyfile or opts.tcp_encryption_keyfile
        self.quality = opts.quality
        self.min_quality = opts.min_quality
        self.speed = opts.speed
        self.min_speed = opts.min_speed
        # printing and file transfer:
        FileTransferHandler.init_opts(self, opts)

        if DETECT_LEAKS:
            from xpra.util import detect_leaks

            detailed = []
            # example: warning, uses ugly direct import:
            # try:
            #    from xpra.x11.bindings.ximage import XShmImageWrapper       #@UnresolvedImport
            #    detailed.append(XShmImageWrapper)
            # except:
            #    pass
            print_leaks = detect_leaks(log, detailed)
            self.timeout_add(10 * 1000, print_leaks)
Example #7
0
    def init(self, opts):
        if self._init_done:
            #the gtk client classes can inherit this method
            #from multiple parents, skip initializing twice
            return
        self._init_done = True
        for c in XpraClientBase.__bases__:
            c.init(self, opts)
        self.compression_level = opts.compression_level
        self.display = opts.display
        self.username = opts.username
        self.password = opts.password
        self.password_file = opts.password_file
        self.bandwidth_limit = parse_with_unit("bandwidth-limit",
                                               opts.bandwidth_limit)
        bandwidthlog("init bandwidth_limit=%s", self.bandwidth_limit)
        self.encryption = opts.encryption or opts.tcp_encryption
        if self.encryption:
            crypto_backend_init()
        self.encryption_keyfile = opts.encryption_keyfile or opts.tcp_encryption_keyfile
        #register the authentication challenge handlers:
        ch = tuple(x.strip().lower()
                   for x in (opts.challenge_handlers or "").split(","))

        def has_h(name):
            return "all" in ch or name in ch

        for ch_name in ch:
            if ch_name == "all":
                self.challenge_handlers.update(self.default_challenge_methods)
                break
            method = self.default_challenge_methods.get(ch_name)
            if method:
                self.challenge_handlers[ch_name] = method
                continue
            log.warn("Warning: unknown challenge handler '%s'", ch_name)
        if DETECT_LEAKS:
            from xpra.util import detect_leaks
            detailed = []
            #example: warning, uses ugly direct import:
            #try:
            #    from xpra.x11.bindings.ximage import XShmImageWrapper       #@UnresolvedImport
            #    detailed.append(XShmImageWrapper)
            #except:
            #    pass
            print_leaks = detect_leaks(log, detailed)
            self.timeout_add(10 * 1000, print_leaks)
Example #8
0
 def init_leak_detection(self):
     if DETECT_MEMLEAKS:
         print_leaks = detect_leaks()
         if print_leaks:
             def leak_thread():
                 while True:
                     print_leaks()
                     sleep(10)
             from xpra.make_thread import start_thread
             start_thread(leak_thread, "leak thread", daemon=True)
     if DETECT_FDLEAKS:
         self.fds = livefds()
         def print_fds():
             fds = livefds()
             newfds = fds-self.fds
             self.fds = fds
             log.info("print_fds() new fds=%s (total=%s)", newfds, len(fds))
             return True
         self.timeout_add(10, print_fds)