Commit 22eb0baa authored by Guillaume Seguin's avatar Guillaume Seguin

Fix disconnect action for TCP connections

parent a5c5a924
...@@ -123,8 +123,10 @@ class printcore(): ...@@ -123,8 +123,10 @@ class printcore():
if not is_serial: if not is_serial:
self.printer_tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.printer_tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.timeout = 0.25 self.timeout = 0.25
self.printer_tcp.settimeout(1.0)
try: try:
self.printer_tcp.connect((hostname, port)) self.printer_tcp.connect((hostname, port))
self.printer_tcp.settimeout(self.timeout)
self.printer = self.printer_tcp.makefile() self.printer = self.printer_tcp.makefile()
except socket.error: except socket.error:
print _("Could not connect to %s:%s:") % (hostname, port) print _("Could not connect to %s:%s:") % (hostname, port)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment