Ejemplo n.º 1
0
 def init(self, opts):
     self.pings = opts.pings
     self.bandwidth_limit = parse_with_unit("bandwidth-limit",
                                            opts.bandwidth_limit)
     bandwidthlog("bandwidth-limit(%s)=%s", opts.bandwidth_limit,
                  self.bandwidth_limit)
     self.init_cpuinfo()
Ejemplo n.º 2
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.bandwidth_limit = parse_with_unit("bandwidth-limit", opts.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
        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)
Ejemplo n.º 3
0
 def init_attributes(self, file_transfer="no", file_size_limit=10, printing="no",
                     open_files="no", open_url="no", open_command=None, can_ask=True):
     filelog("file transfer: init_attributes%s",
             (file_transfer, file_size_limit, printing, open_files, open_url, open_command, can_ask))
     def pbool(name, v):
         return parse_bool(name, v, True)
     def pask(v):
         return v.lower() in ("ask", "auto")
     fta = pask(file_transfer)
     self.file_transfer_ask = fta and can_ask
     self.file_transfer = fta or pbool("file-transfer", file_transfer)
     self.file_size_limit = parse_with_unit("file-size-limit", file_size_limit, "B", min_value=0)
     self.file_chunks = FILE_CHUNKS_SIZE
     pa = pask(printing)
     self.printing_ask = pa and can_ask
     self.printing = pa or pbool("printing", printing)
     ofa = pask(open_files)
     self.open_files_ask = ofa and can_ask
     self.open_files = ofa or pbool("open-files", open_files)
     #FIXME: command line options needed here:
     oua = pask(open_url)
     self.open_url_ask = oua and can_ask
     self.open_url = oua or pbool("open-url", open_url)
     self.file_ask_timeout = SEND_REQUEST_TIMEOUT
     self.open_command = open_command
     self.files_requested = {}
     self.files_accepted = {}
     self.file_request_callback = {}
     filelog("file transfer attributes=%s", self.get_file_transfer_features())
Ejemplo n.º 4
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)
Ejemplo n.º 5
0
 def init(self, opts):
     self.pings = opts.pings
     self.bandwidth_limit = parse_with_unit("bandwidth-limit",
                                            opts.bandwidth_limit)
     self.bandwidth_detection = opts.bandwidth_detection
     bandwidthlog("init bandwidth_limit=%s", self.bandwidth_limit)
Ejemplo n.º 6
0
 def parse_speed(v):
     return parse_with_unit("speed", v)