mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-24 07:06:41 +00:00
iputil.py: retry address queries on EINTR. fixes #1381
Signed-off-by: Daira Hopwood <david-sarah@jacaranda.org>
This commit is contained in:
parent
d85a75d7f6
commit
6a445d73bc
@ -1,5 +1,5 @@
|
|||||||
# from the Python Standard Library
|
# from the Python Standard Library
|
||||||
import os, re, socket, sys, subprocess
|
import os, re, socket, sys, subprocess, errno
|
||||||
|
|
||||||
# from Twisted
|
# from Twisted
|
||||||
from twisted.internet import defer, threads, reactor
|
from twisted.internet import defer, threads, reactor
|
||||||
@ -235,8 +235,14 @@ def _synchronously_find_addresses_via_config():
|
|||||||
|
|
||||||
def _query(path, args, regex):
|
def _query(path, args, regex):
|
||||||
env = {'LANG': 'en_US.UTF-8'}
|
env = {'LANG': 'en_US.UTF-8'}
|
||||||
p = subprocess.Popen([path] + list(args), stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
|
for trial in xrange(5):
|
||||||
(output, err) = p.communicate()
|
try:
|
||||||
|
p = subprocess.Popen([path] + list(args), stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
|
||||||
|
(output, err) = p.communicate()
|
||||||
|
break
|
||||||
|
except OSError, e:
|
||||||
|
if e.errno == errno.EINTR:
|
||||||
|
continue
|
||||||
|
|
||||||
addresses = []
|
addresses = []
|
||||||
outputsplit = output.split('\n')
|
outputsplit = output.split('\n')
|
||||||
|
Loading…
Reference in New Issue
Block a user