aboutsummaryrefslogtreecommitdiffstats
path: root/signald/main.py
diff options
context:
space:
mode:
authorStavros Korokithakis <hi@stavros.io>2018-12-07 18:17:52 +0200
committerStavros Korokithakis <hi@stavros.io>2018-12-07 18:17:52 +0200
commit0aca0ae50a7336c705a92f2444d6fcd1b3e283e9 (patch)
treec2406feab14ce3c9a24dadb324472ef815e1859e /signald/main.py
parent4f63fe74a96d7f642147a445a04a29b8808fa5b5 (diff)
downloadpysignald-0aca0ae50a7336c705a92f2444d6fcd1b3e283e9.tar.gz
pysignald-0aca0ae50a7336c705a92f2444d6fcd1b3e283e9.zip
Support TCP sockets
Diffstat (limited to 'signald/main.py')
-rw-r--r--signald/main.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/signald/main.py b/signald/main.py
index 2c12322..cfad0e8 100644
--- a/signald/main.py
+++ b/signald/main.py
@@ -32,7 +32,12 @@ class Signal:
def _get_socket(self) -> socket.socket:
"Create a socket, connect to the server and return it."
- s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
+
+ # Support TCP sockets on the sly.
+ if isinstance(self.socket_path, tuple):
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ else:
+ s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
s.connect(self.socket_path)
return s