Skip to content
Snippets Groups Projects
Commit e0501640 authored by Chris Hines's avatar Chris Hines
Browse files

try again to fix TWS

parent c00d443d
No related branches found
No related tags found
4 merge requests!77Revert "disable agressive kill and restart",!35Dev,!26Dev,!25Dev
Pipeline #10388 passed
...@@ -183,12 +183,9 @@ class TWSProxy(threading.Thread): ...@@ -183,12 +183,9 @@ class TWSProxy(threading.Thread):
logger = logging.getLogger() logger = logging.getLogger()
closed = False closed = False
name = threading.current_thread().name name = threading.current_thread().name
failcount=0 while not closed:
failthresh = 10
while not closed and failcount < failthresh:
r,w,e = select.select([src],[],[],TWSProxy.TIMEOUT) r,w,e = select.select([src],[],[],TWSProxy.TIMEOUT)
if len(r) > 0: if len(r) > 0:
failcount=0
buff = None buff = None
msglength = -1 msglength = -1
try: try:
...@@ -196,26 +193,23 @@ class TWSProxy(threading.Thread): ...@@ -196,26 +193,23 @@ class TWSProxy(threading.Thread):
if buff is None: if buff is None:
continue continue
except ConnectionResetError as e: except ConnectionResetError as e:
close = True closed = True
continue continue
except Exception as e: except Exception as e:
import traceback import traceback
logger.error(traceback.format_exc()) logger.error(traceback.format_exc())
# closed = True closed = True
continue
msglength = len(buff) msglength = len(buff)
if msglength > 0: if msglength > 0:
TWSProxy.reliablesend(dest,buff,msglength) TWSProxy.reliablesend(dest,buff,msglength)
if msglength == 0: if msglength == 0:
#dest.send(buff)
dest.shutdown(shuttype) dest.shutdown(shuttype)
initshutdown.set() initshutdown.set()
closed = True closed = True
else:
failcount=failcount+1
if failcount > failthresh: dest.shutdown(shuttype)
dest.shutdown(shuttype) initshutdown.set()
initshutdown.set()
def main(): def main():
from . import server from . import server
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment