Skip to content

Commit

Permalink
#1761 generalize init_sockets so we can move some domain specific che…
Browse files Browse the repository at this point in the history
…cks to the fileprint mixin

git-svn-id: https://xpra.org/svn/Xpra/trunk@18652 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Mar 1, 2018
1 parent f573901 commit e0b838b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
11 changes: 11 additions & 0 deletions src/xpra/server/mixins/fileprint_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ def init(self, opts):
def threaded_setup(self):
self.init_printing()

def init_sockets(self, sockets):
#verify we have a local socket for printing:
unixsockets = [info for socktype, _, info in sockets if socktype=="unix-domain"]
printlog("local unix domain sockets we can use for printing: %s", unixsockets)
if not unixsockets and self.file_transfer.printing:
if not WIN32:
printlog.warn("Warning: no local sockets defined,")
printlog.warn(" disabling printer forwarding")
printlog("printer forwarding disabled")
self.file_transfer.printing = False


def get_server_features(self, _source):
f = self.file_transfer.get_file_transfer_features()
Expand Down
3 changes: 3 additions & 0 deletions src/xpra/server/mixins/stub_server_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ def cleanup(self):
def setup(self):
pass

def init_sockets(self, _sockets):
pass

def threaded_setup(self):
pass

Expand Down
11 changes: 2 additions & 9 deletions src/xpra/server/server_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,15 +780,8 @@ def timeout_check():
######################################################################
# client connections:
def init_sockets(self, sockets):
ServerCore.init_sockets(self, sockets)
#verify we have a local socket for printing:
nontcpsockets = [info for socktype, _, info in sockets if socktype=="unix-domain"]
netlog("local sockets we can use for printing: %s", nontcpsockets)
if not nontcpsockets and self.file_transfer.printing:
if not WIN32:
log.warn("Warning: no local sockets defined,")
log.warn(" disabling printer forwarding")
self.file_transfer.printing = False
for c in ServerBase.__bases__:
c.init_sockets(self, sockets)

def cleanup_protocol(self, protocol):
netlog("cleanup_protocol(%s)", protocol)
Expand Down
2 changes: 1 addition & 1 deletion src/xpra/server/server_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,7 @@ def disconnect_protocol(self, protocol, *reasons):
self.cancel_verify_connection_accepted(protocol)
self.cancel_upgrade_to_rfb_timer(protocol)
protocol.send_disconnect(reasons)
self.cleanup_protocol(self, protocol)
self.cleanup_protocol(protocol)

def cleanup_protocol(self, proto):
pass
Expand Down

0 comments on commit e0b838b

Please sign in to comment.