Skip to content

Commit

Permalink
#494: bump packet size limits to handle file transfers
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@11179 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Nov 11, 2015
1 parent 0b6dd77 commit 1aa721b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/xpra/server/proxy/proxy_instance_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ def run(self):
self.server_protocol.large_packets.append("window-icon")
self.server_protocol.large_packets.append("keymap-changed")
self.server_protocol.large_packets.append("server-settings")
if self.caps.boolget("file-transfer"):
self.server_protocol.large_packets.append("send-file")
self.server_protocol.set_compression_level(self.session_options.get("compression_level", 0))
self.server_protocol.enable_default_encoder()

Expand Down Expand Up @@ -551,14 +553,19 @@ def process_server_packet(self, proto, packet):
elif packet_type=="hello":
c = typedict(packet[1])
maxw, maxh = c.intpair("max_desktop_size", (4096, 4096))
proto.max_packet_size = maxw*maxh*4*4

caps = self.filter_server_caps(c)
#add new encryption caps:
if self.cipher:
padding_options = self.caps.strlistget("cipher.padding.options", [DEFAULT_PADDING])
auth_caps = new_cipher_caps(self.client_protocol, self.cipher, self.encryption_key, padding_options)
caps.update(auth_caps)
#may need to bump packet size:
proto.max_packet_size = maxw*maxh*4*4
file_transfer = self.caps.boolget("file-transfer") and c.boolget("file-transfer")
file_size_limit = max(self.caps.intget("file-size-limit"), c.intget("file-size-limit"))
file_max_packet_size = int(file_transfer) * (1024 + file_size_limit*1024*1024)
self.client_protocol.max_packet_size = max(self.client_protocol.max_packet_size, file_max_packet_size)
self.server_protocol.max_packet_size = max(self.server_protocol.max_packet_size, file_max_packet_size)
packet = ("hello", caps)
elif packet_type=="info-response":
#adds proxy info:
Expand Down
7 changes: 7 additions & 0 deletions src/xpra/server/server_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,7 @@ def get_window_id(wid):
log("process_hello serversource=%s", ss)
try:
ss.parse_hello(c)
proto.max_packet_size = max(proto.max_packet_size, int(ss.file_transfer) * (1024 + ss.file_size_limit*1024*1024))
except:
#close it already
ss.close()
Expand All @@ -898,6 +899,12 @@ def get_window_id(wid):
send_ui = ui_client and not is_request
self.idle_add(self.parse_hello_ui, ss, c, auth_caps, send_ui, share_count)

def accept_client(self, proto, c):
ServerCore.accept_client(self, proto, c)
#may need to bump file size limit for file transfers:
proto.max_packet_size = max(proto.max_packet_size, int(self.file_transfer) * (1024 + self.file_size_limit*1024*1024))


def get_server_source_class(self):
from xpra.server.source import ServerSource
return ServerSource
Expand Down

0 comments on commit 1aa721b

Please sign in to comment.