aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2016-03-08 19:20:41 -0500
committerEric S. Raymond <esr@thyrsus.com>2016-03-08 19:20:41 -0500
commitdaa07c85304f3fecebbf7dcb1141353c30677729 (patch)
tree9112145d53248deb332c89245200ec14149967a3
parentProxy support (diff)
downloadirker-daa07c85304f3fecebbf7dcb1141353c30677729.tar.xz
Fix the way the proxy patch broke normal operation.
-rwxr-xr-xirkerd12
1 files changed, 9 insertions, 3 deletions
diff --git a/irkerd b/irkerd
index dc592ff..6cfa964 100755
--- a/irkerd
+++ b/irkerd
@@ -65,7 +65,11 @@ import re
import select
import signal
import socket
-import socks
+try:
+ import socks
+ socks_on = True
+except ImportError:
+ socks_on = False
try: # Python 3
import socketserver
except ImportError: # Python 2
@@ -294,9 +298,11 @@ class IRCServerConnection():
self.target = target
self.nickname = nickname
try:
- self.socket = socks.socksocket(socket.AF_INET, socket.SOCK_STREAM)
- if PROXY_TYPE:
+ if socks_on and PROXY_TYPE:
+ self.socket = socks.socksocket(socket.AF_INET,socket.SOCK_STREAM)
self.socket.set_proxy(PROXY_TYPE, PROXY_HOST, PROXY_PORT)
+ else:
+ self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if target.ssl:
self.socket = self._wrap_socket(
socket=self.socket, target=target, **kwargs)