Skip to content

Commit

Permalink
#1761 disable more features and their packet handlers if we find that…
Browse files Browse the repository at this point in the history
… we cannot load them or that they are disabled by the configuration

git-svn-id: https://xpra.org/svn/Xpra/trunk@18656 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Mar 1, 2018
1 parent 5305b5b commit 7e373ea
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 42 deletions.
11 changes: 7 additions & 4 deletions src/xpra/server/mixins/audio_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def __init__(self):
self.supports_microphone = False
self.speaker_codec_str = ""
self.microphone_codec_str = ""
self.speaker_codecs = ()
self.microphone_codecs = ()
self.sound_properties = typedict()

def init(self, opts):
Expand Down Expand Up @@ -291,7 +293,8 @@ def _process_sound_data(self, proto, packet):


def init_packet_handlers(self):
self._authenticated_ui_packet_handlers.update({
"sound-control": self._process_sound_control,
"sound-data": self._process_sound_data,
})
if self.supports_speaker or self.supports_microphone:
self._authenticated_ui_packet_handlers.update({
"sound-control": self._process_sound_control,
"sound-data": self._process_sound_data,
})
16 changes: 9 additions & 7 deletions src/xpra/server/mixins/child_command_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def noop():
reaper_cleanup()


def get_server_features(self, source):
def get_server_features(self, _source):
return {
"start-new-commands" : self.start_new_commands,
"exit-with-children" : self.exit_with_children,
Expand Down Expand Up @@ -278,9 +278,11 @@ def _process_command_signal(self, _proto, packet):


def init_packet_handlers(self):
self._authenticated_packet_handlers.update({
"command-signal": self._process_command_signal,
})
self._authenticated_ui_packet_handlers.update({
"start-command": self._process_start_command,
})
if COMMAND_SIGNALS:
self._authenticated_packet_handlers.update({
"command-signal" : self._process_command_signal,
})
if self.start_new_commands:
self._authenticated_ui_packet_handlers.update({
"start-command" : self._process_start_command,
})
11 changes: 6 additions & 5 deletions src/xpra/server/mixins/clipboard_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,9 @@ def send_clipboard_packet(self, *parts):


def init_packet_handlers(self):
self._authenticated_packet_handlers.update({
"set-clipboard-enabled": self._process_clipboard_enabled_status,
})
for x in ("token", "request", "contents", "contents-none", "pending-requests", "enable-selections", "loop-uuids"):
self._authenticated_ui_packet_handlers["clipboard-%s" % x] = self._process_clipboard_packet
if self.clipboard:
self._authenticated_packet_handlers.update({
"set-clipboard-enabled": self._process_clipboard_enabled_status,
})
for x in ("token", "request", "contents", "contents-none", "pending-requests", "enable-selections", "loop-uuids"):
self._authenticated_ui_packet_handlers["clipboard-%s" % x] = self._process_clipboard_packet
7 changes: 4 additions & 3 deletions src/xpra/server/mixins/dbusrpc_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def _process_rpc(self, proto, packet):


def init_packet_handlers(self):
self._authenticated_ui_packet_handlers.update({
"rpc" : self._process_rpc,
})
if self.supports_dbus_proxy:
self._authenticated_ui_packet_handlers.update({
"rpc" : self._process_rpc,
})
22 changes: 13 additions & 9 deletions src/xpra/server/mixins/fileprint_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,16 @@ def _process_send_data_response(self, proto, packet):


def init_packet_handlers(self):
self._authenticated_packet_handlers.update({
"printers": self._process_printers,
"send-file": self._process_send_file,
"ack-file-chunk": self._process_ack_file_chunk,
"send-file-chunk": self._process_send_file_chunk,
"send-data-request": self._process_send_data_request,
"send-data-response": self._process_send_data_response,
"print": self._process_print,
})
if self.file_transfer.printing:
self._authenticated_packet_handlers.update({
"printers": self._process_printers,
"print": self._process_print,
})
if self.file_transfer.printing or self.file_transfer.file_transfer:
self._authenticated_packet_handlers.update({
"send-file": self._process_send_file,
"ack-file-chunk": self._process_ack_file_chunk,
"send-file-chunk": self._process_send_file_chunk,
"send-data-request": self._process_send_data_request,
"send-data-response": self._process_send_data_response,
})
7 changes: 4 additions & 3 deletions src/xpra/server/mixins/logging_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def dec(x):


def init_packet_handlers(self):
self._authenticated_packet_handlers.update({
"logging" : self._process_logging,
})
if self.remote_logging:
self._authenticated_packet_handlers.update({
"logging" : self._process_logging,
})
13 changes: 7 additions & 6 deletions src/xpra/server/mixins/notification_forwarder.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def init_notification_forwarder(self):
log("%s", self.notifications_forwarder)
except Exception as e:
log("init_notification_forwarder()", exc_info=True)
self.notifications = False
self.notify_setup_error(e)

def notify_setup_error(self, exception):
Expand Down Expand Up @@ -139,9 +140,9 @@ def _process_notification_action(self, proto, packet):


def init_packet_handlers(self):
self._authenticated_ui_packet_handlers.update({
#notifications:
"notification-close": self._process_notification_close,
"notification-action": self._process_notification_action,
"set-notify": self._process_set_notify,
})
if self.notifications:
self._authenticated_ui_packet_handlers.update({
"notification-close" : self._process_notification_close,
"notification-action" : self._process_notification_action,
"set-notify" : self._process_set_notify,
})
11 changes: 6 additions & 5 deletions src/xpra/server/mixins/webcam_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,9 @@ def _process_webcam_frame(self, proto, packet):
ss.process_webcam_frame(device_id, frame_no, encoding, w, h, data)

def init_packet_handlers(self):
self._authenticated_packet_handlers.update({
"webcam-start": self._process_webcam_start,
"webcam-stop": self._process_webcam_stop,
"webcam-frame": self._process_webcam_frame,
})
if self.webcam_enabled:
self._authenticated_packet_handlers.update({
"webcam-start" : self._process_webcam_start,
"webcam-stop" : self._process_webcam_stop,
"webcam-frame" : self._process_webcam_frame,
})

0 comments on commit 7e373ea

Please sign in to comment.