Skip to content

Commit a7b44a4

Browse files
committed
Add support for running the prober in jython.
1 parent abdfb1b commit a7b44a4

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

probes.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
#!/usr/bin/python
22

33
import socket
4-
import select
54
import errno
65
import logging
7-
import socks
86
import os
7+
import platform
8+
9+
if platform.system() != 'Java':
10+
from select import select
11+
else:
12+
from select import cpython_compatible_select as select
13+
14+
# Disable socks support in Jython
15+
if platform.system() != 'Java':
16+
import socks
17+
else:
18+
if os.environ.has_key('socks_proxy'):
19+
logging.warn('Unable to honour socks_proxy environment variable, unsupported in Jython')
920

1021
from prober_utils import *
1122

@@ -52,7 +63,7 @@ def process_response(self, sock):
5263
if got_done:
5364
# If no data then we're done (the server hasn't sent anything further)
5465
# we allow 500ms to give the followup time to arrive
55-
if not select.select([sock.fileno(),],[],[],0.5)[0]:
66+
if not select([sock.fileno(),],[],[],0.5)[0]:
5667
break
5768

5869
try:

0 commit comments

Comments
 (0)